Hello, everyone.Xiaofan.
write sth. upfront
I don't know if you have any financial friends, I have such a friend who often complains to me. At the end of the month is a nightmare, there are always endless shifts, endless nights, endless statements.
Hearing this, this is not a living a "big cousin" it, this overtime with our programmers have a spell, can not help but evil a smile, the heart balanced a lot.
Being a cow or a horse, it's not easy for everyone. I don't envy you counting money until your hands cramp, you don't envy me writing CRUD all day long until my hands get calluses 🤣
Trolling is trolling, food must be eaten, and work must continue to be done. So it was good to catch the weekend and spend the day helping a friend write a widget
I. Functional requirements
After bragging with my friend for half a day, I finally finalized the requirements. Just a very simple function, by name, total the amount of the same name in table 1 and table 2.
Specific data consolidation is shown in the figure below
Although a very simple function, but if not with the help of tools, too much data, manual to check, integrate data, or need to be very time-consuming and physical strength.
No wonder, the friend disappeared by the end of the month, so the time was spent on this.
II. Technical selection
As the requirements are relatively simple, only excel import and export, data integration functions. Does not involve database-related operations.
All things considered, the choice was
PowerBuilder
utilizationPowerBuilder
Development of desktop applications, although the interface is a little ugly, but the development efficiency is quite high, simple drag and drop to complete the interface (for the front-end technology is not familiar with the partners is very friendly)
Secondly, by not requiring a database and forgoing web development of the application, cloud server costs are again eliminated. Ultimately, it only needs to be packaged asexe
The file is ready to run!
at last
Powerbuilder
The strongest assisted development, bar none. Sort of a boon for PBers
III. Simple interface layout
IV. Core code
① Import into excel
string ls_pathName,ls_FileName //path+file name,file name
long ll_Net
long rows
dw_1.reset()
uo_datawindowex dw
dw = create uo_datawindowex
dw_1.setredraw(false)
ll_Net = GetFileSaveName("Please select file",ls_pathName,ls_FileName, "xlsx", "Excel text(*.xlsx),*.xlsx")
rows = (dw_1,ls_pathName,1,0,0)
destroy dw
dw_1.setredraw(true)
MessageBox("Message", "Imported successfully " + string(rows) + "Row data")
② Data Integration
long ll_row,ll_sum1,ll_sum2
long ll_i,ll_j
long ll_yes
string ls_err
//Reset Table 3 data
dw_3.reset()
//process table one data
ll_sum1 = dw_1.rowcount( )
if ll_sum1<=0 then
ls_err = "Table 1 data not imported, please import data first"
goto err
end if
for ll_i=1 to ll_sum1
ll_row = dw_3.insertrow(0)
dw_3.[ll_row] = ll_row //serial number
dw_3.[ll_row] = dw_1.[ll_i] //Name
dw_3.[ll_row] =dw_1.[ll_i] //salary
dw_3.[ll_row]=dw_1.[ll_i] //pension
dw_3.[ll_row]=dw_1.[ll_i] //medical
dw_3.[ll_row]=dw_1.[ll_i] //Industrial injury
dw_3.[ll_row]=dw_1.[ll_i] //Unemployment
dw_3.[ll_row]=dw_1.[ll_i] //Provident Fund
dw_3.[ll_row]=dw_1.[ll_i] //annuity
next
//Process the data in Table 2
ll_sum2 = dw_2.rowcount( )
if ll_sum2<=0 then
ls_err = "Table 2 data not imported, please import data first"
goto err
end if
for ll_j =1 to ll_sum2
string ls_name
ls_name = dw_2.[ll_j]
ll_yes = dw_3.Find("name = '"+ ls_name +"' ",1,dw_3.rowcount())
if ll_yes<0 then
ls_err = "Find failed!" +
goto err
end if
if ll_yes = 0 then //not found
ll_row = dw_3.InsertRow (0)
dw_3.ScrollToRow(ll_row)
dw_3.[ll_row] = ll_row //Serial Number
dw_3.[ll_row] = dw_1.[ll_j] //Name
dw_3.[ll_row] = dw_1.[ll_j] // salary
dw_3.[ll_row] = dw_1.[ll_j] //pension
dw_3.[ll_row] = dw_1.[ll_j] //medical
dw_3.[ll_row] = dw_1.[ll_j] //Worker's Injury
dw_3.[ll_row] = dw_1.[ll_j] //Unemployment
dw_3.[ll_row] = dw_1.[ll_j] //Provident Fund
dw_3.[ll_row] = dw_1.[ll_j] //annuity
end if
if ll_yes >0 then //found
dec{2} ld_salary,ld_endowment,ld_medical,ld_injury,ld_unemployment,ld_publicacc,ld_annuity
ld_salary = dw_3.[ll_yes] + dw_2.[ll_j]
ld_endowment = dw_3.[ll_yes] + dw_2.[ll_j]
ld_medical = dw_3.[ll_yes] + dw_2.[ll_j]
ld_injury = dw_3.[ll_yes] + dw_2.[ll_j]
ld_unemployment = dw_3.[ll_yes] + dw_2.[ll_j]
ld_publicacc = dw_3.[ll_yes] + dw_2.[ll_j]
ld_annuity = dw_3.[ll_yes] + dw_2.[ll_j]
dw_3.[ll_yes] = ld_salary //salary
dw_3.[ll_yes] = ld_endowment //pension
dw_3.[ll_yes]= ld_medical //medical
dw_3.[ll_yes]=ld_injury //work injury
dw_3.[ll_yes]=ld_unemployment //unemployment
dw_3.[ll_yes]=ld_publicacc //Public Provident Fund
dw_3.[ll_yes]=ld_publicacc //annuity
end if
dw_3.[ll_yes]=ld_publicacc //annuity end if
return 0
err.
messagebox('error message',ls_err)
③ excel export
string ls_err
string ls_pathName,ls_FileName //path+file name,file name
long ll_Net
if dw_3.rowcount() = 0 then
ls_err = "Integration data is empty, cannot export"
goto err
end if
uo_wait_box luo_waitbox
luo_waitbox = create uo_wait_box
luo_waitBox.OpenWait(64,RGB(220,220,220),RGB(20,20,20),TRUE, "Exporting ", 8,rand(6) - 1)
long rows
CreateDirectory("tmp")
uo_datawindowex dw
dw = create uo_datawindowex
ll_Net = GetFileSaveName("Select Path",ls_pathName,ls_FileName, "xlsx", "Excel Text(*.xlsx),*.xlsx")
rows = (dw_3,ls_pathName,true,true)
destroy dw
destroy luo_waitbox
MessageBox("Message", "Successfully exported " + string(rows) + " line data")
return 0
err.
messagebox('Error message',ls_err)
V. Final effect
That's all for this sharing.★,°:.☆( ̄▽ ̄)/$:.°★ I hope it helps you. I hope this helps, and I wish I had more friends like this, so without further ado, I'm going to scrub in.
We'll see you next time ヾ(-ω-`)o (●'◡'●)