1. First, make some minor changes to os3grid: Add the following code:
Function strlen (STR)
{
VaR Len;
VaR I;
Len = 0;
For (I = 0; I {
If (Str. charcodeat (I)> 255) Len + = 2; else Len ++;
}
Return Len;
}
Modify the following line in function grid_cell_txt_edit (cell), mainly to cope with Chinese characters.
S + = 'size = "'+ strlen (VAL) + '"';
In addition, modify some colors
This. Cols = {"hover": "# d5f1ff ",
2. Payroll Structure
Considering that each unit has different sets of books, a one-to-multiple set of books table is created.
Create Table pq_unitgzxm (
Unit_id char (8) Not null default '',
Xmbh int not null default 0,
Xmbm varchar (3) not null primary key,
Xmmc varchar (200) not null default '',
Lx varchar (200) not null default '',
Jsgs varchar (200) not null default''
)
Insert into pq_unitgzxm values ('20140901', 1, 'f01', 'employee ID ', 'System value ','');
Insert into pq_unitgzxm values ('20140901', 2, 'f02', 'name', 'System value ','');
Insert into pq_unitgzxm values ('201312', 3, 'f03', 'unit ', 'System value ','');
Insert into pq_unitgzxm values ('20170101', 4, 'f04 ', 'Basic sale', 'input value ','');
Insert into pq_unitgzxm values ('123', 5, 'f05 ', 'bonus', 'input value ','');
Insert into pq_unitgzxm values ('123456', 6, 'f06', 'pay-as-you-go ', 'calculated value ','');
Insert into pq_unitgzxm values ('20140901', 7, 'f07', 'personal income tax ', 'calculated value ','');
Insert into pq_unitgzxm values ('20140901', 8, 'f08', 'wage payable ', 'calculation value ','');
Insert into pq_unitgzxm values ('201312', 9, 'f09', 'pay-as-you-go ', 'calculated value ','');
How to use space redundancy for actual wage Input
Create table pq_gzxm (
Gzb_id char (8) not null default '',
Employee_id char (8) not null default '',
Xm varchar (400) not null default '',
Employeecontract_id char (8) not null default '',
Gzdata1 decimal not null default '0 ',
Gzdata2 decimal not null default '0 ',
Gzdata3 decimal not null default '0 ',
Gzdata4 decimal not null default '0 ',
Gzdata5 decimal not null default '0 ',
Gzdata6 decimal not null default '0 ',
Gzdata7 decimal not null default '0 ',
Gzdata8 decimal not null default '0 ',
Gzdata9 decimal not null default '0 ',
Gzdata10 decimal not null default '0 ',
Gzdata11 decimal not null default '0 ',
Gzdata12 decimal not null default '0 ',
Gzdata13 decimal not null default '0 ',
Gzdata14 decimal not null default '0 ',
Gzdata15 decimal not null default '0 ',
Gzdata16 decimal not null default '0 ',
Gzdata17 decimal not null default '0 ',
Gzdata18 decimal not null default '0 ',
Gzdata19 decimal not null default '0 ',
Gzdata20 decimal not null default '0'
)
Insert into pq_gzxm (gzb_id, employee_id, xm, employeecontract_id, gzdata1) values ('20140901', '20160901', 'san Zhang ', '20160302', 0 );
Insert into pq_gzxm (gzb_id, employee_id, xm, employeecontract_id, gzdata1) values ('20170101', '20170101', 'l4 ', '20160', 0 );
3. Generate a form
Function show_form ($ unit_id = '', $ gzyear ='', $ gzmonth = '', $ error = ''){
Global $ db, $ me, $ t, $ _ POST;
Extract ($ _ POST );
If ($ unit_id &&! $ Error ){
$ Rs = $ db-> Execute ("select * from". TBL_UNITGZXM. "where unit_id = '$ unit_id '");
$ Items = $ rs-> GetArray ();
$ T-> assign ('items ', $ items );
// $ Rs = $ db-> Execute ("select e. employee_id, e. xm, ec. dwmc from ". TBL_EMPLOYEE. "e ,". TBL_EMPLOYEECONTRACT. "ec ,". TBL_UNITCONTRACT. "uc where e. employee_id =
Ec. employee_id and ec. unitcontract_id = uc. unitcontract_id and uc. unit_id = '$ unit_id '");
// $ T-> assign ('ployees', $ rs-> GetArray ());
$ Gzb_id = '';
$ Dwmc = '';
$ Gzb = $ db-> GetRow ("select gzb_id, dwmc from". TBL_GZB. "where unit_id = '$ unit_id'
And gzyear = '000000' and gzmonth = '04 '");
$ Gzb_id = $ gzb ['gzb _ id'];
$ Dwmc = $ gzb ['dwmc '];
$ Gz_array = array ();
$ Rs = $ db-> Execute ("select * from". TBL_GZXM. "where gzb_id = '$ gzb_id '");
While (! $ Rs-> EOF ){
$ Gzdata_array = array ();
// Gzdata1 starts from 1
For ($ I = 1, $ COUNT = count ($ items)-3; $ I array_push ($ gzdata_array, $ RS-> fields ['gzdata'. $ I]);
}
$ Gzline = array ($ RS-> fields ['employee _ id'], $ RS-> fields ['xm '], $ dwmc, $ gzdata_array );
Array_push ($ gz_array, $ gzline );
$ RS-> movenext ();
}
} Else {
$ T-> assign ($ _ post );
}
// Print_r ($ gz_array );
$ T-> assign ('error', $ error );
$ T-> assign ('gz _ array', $ gz_array );
$ T-> render('salary.html ', page_title,'wrap.html', false );
}
Form template
4 The http_fetch_sync function is as follows:
VaR global_xmlhttp = getxmlhttpinstance ();
Function http_fetch_sync (URL, post_data)
{
Global_xmlhttp = getxmlhttpinstance ();
VaR method = 'get ';
If (typeof (post_data )! = 'Undefined ')
{
Method = 'post ';
}
Try
{
// Global_xmlhttp.open (method, URL, true );
Global_xmlhttp.open (method, URL, false );
}
Catch (E)
{
Alert ('message: '+ e. message + ": url:" + url );
}
If (method = 'post ')
{
Global_xmlhttp.setRequestHeader ('content-type', 'application/x-www-form-urlencoded ');
}
Global_xmlhttp.send (post_data );
Var args = {"responseText": global_xmlhttp.responseText, "responseXML": global_xmlhttp.responseXML,
"Request_id": request_id };
Return args;
}
Trackback: http://tb.blog.csdn.net/TrackBack.aspx? PostId = 668611