I found a problem when doing personnel management software, and the distribution project of salary in wages often changes, and the calculation relationship between wage projects has changed, which has brought great troubles for actual programming. In fact, there are many similar situations in actual work that need to be solved, hoping to provide you with more ideas for reference. Nowadays my solution is as follows. The first step is to create a salary table TBL_GZTZ, which is used to record the salary issuance of the employee, including the issuance of salary. So this table field should be much more, you can put it more than 50.
The surface structure is as follows: TBL_GZTZ
Data Column Name Data Column Type Data Columns ZGBH VARCHAR2 (10) Workers Number MC VARCHAR2 (10) Workers Name Yf Varchar2 (6) Wage Month GZ1Number (12, 2) (Meaning Meeting Project Description Table) GZ2 Number (12, 2 (Meaning Meeting Project Description Table) GZ3 Number (12, 2) (Meaning Meeting Project Description Table below) GZ4 Number (12, 2) (Meaning Meaning Table Table below) GZ5Number (12, 2) (Meaning Meaning Project Table The following table)
Step 2, create a salary project registration form TBL_GZXMDY to record all payrolls between payage and projects in the actual work of salary management. Where the calculation relationship can be a simple four calculation or some functions (limited to PB content functions).
The surface structure is as follows:
Data Column Name Data Column Type Data Columns Enricked XMVARCHAR2 (10) Wage Project Name XMMC VARCHAR2 (20) Wafer Items JSGSVARCHAR2 (40) Calculation Relationship FLAG VARCHAR2 (1) Enable this item (1 is enabled, 0 is stopped use)
Wage distribution project takes out fields from the salary distribution table TBL_GZTZ, which is easy to remove in Oracle (or other data), then insert the removed field into the payroll item definition table TBL_GZXMDY, and define its meaning for each project, no For it, it will not be displayed. For convenience, the example shows relatively clear. Take out the SQL statement of the issued project field is as follows: select cname from col Where tname = 'tbl_gztz' and colorype = 'Numeric' Order by colno;
Wage Project Data Maintenance Examples:
XMXMMC JSGSGZ1 Skills Wage GZ2 Floating Wage GZ3 Insurance Wages GZ4 Staff GZ1 GZ2 GZ5 Rental Fee GZ6 Shift GZ4 - GZ5
In the third step, the basic work is now working, and then the program is implemented. First, define a data window of a Grid style, the data source selects the TBL_GZTZ table. And put it in the window and do some databases. In the OPEN event of the window, you will first initialize the set wage distribution project, set the tie, set the visible item. The specific code is as follows:
DW_1.SetTransObject (SQLCA) String LS_XM, LS_XMMC / / Defines Variables, Store Wages Declare CURSOR FOR // Defines Cursors, Takes Out of Wages SELECT XM, XMMC from TBL_GZXMDY; Open C1; Fetch C1 INTO: LS_XM,: LS_XMMC ; // Cycle extraction data into the variable do while sqlca.sqlcode = 0 if isnull (ls_xmmc) or LS_XMMC = '' Then // Hide DW_1.MODIFY (LS_XM "for unfained salary projects DW_1.MODIFY (LS_XM ". Width = 0 ") ELSE // Set the Table DW_1.MODIFY (LS_XM "_ T.Text = '" LS_XMMC ") end if fetch c1 inTo: LS_XM,: ls_xmmc; loopclose C1; DW_1.ReTrieve () then, of course, That is to set the data window and make it automatic computing. The itemchanged event of the data window is triggered when each column value changes. We can implement the automatic calculation function as long as we program it.
String ls_xm, ls_jsgs // Define variables, store salary projects, calculate formula string ls_dwonamedouble ldc_je // Get the results value of calculation formulas this.accepttext () Declare c1 cursor for // Define cursors, the meaning of the wage project SELECT XM, JSGS From TBL_GZXMDY; Open C1; FETCH C1 INTO: LS_XM,: LS_JSGS; // Cycle extraction data to variables DO while sqlca.sqlcode = 0 if isnull (ls_jsgs) or ls_jsgs = '' Then else // calculate statistics column result, utilization Evaluate calculates LDC_JE = Double (DW_1.DESCRIBE ("Evaluate ('" ")") ") // set calculation results to salary statistics items this.SetItemnumber (Row, LS_XM, LDC_JE) END IF FETCH C1 INTO: LS_XM,: LS_JSGS; LoopClose C1;
The program has been passed under PB7.0 ORACLE8I.