門診收費票據列印程式碼,望大家指正

guess1975發表於2011-01-27


string ls_name,ls_sex,ls_age,ls_type,ls_menzrq,ls_menzsj,ls_menzfl,ls_menzks,ls_zhuanj,ls_guahf,ls_caozy,c2
ls_name=trim(sle_2.text)
ls_sex=trim(ddplb_1.text)
ls_age=trim(sle_13.text)
ls_type=trim(ddplb_2.text)
select to_char(sysdate,'yyyy-mm-dd') into :ls_menzrq from dual;
ls_menzfl="普通"
ls_menzks="0013"
ls_zhuanj=""
ls_guahf=""
ls_caozy=gl_code
Declare myfun Procedure for
GetMenZH(
:ls_name,
:ls_sex,
:ls_age,
:ls_type,
:ls_menzrq,
:ls_menzsj,
:ls_menzfl,
:ls_menzks,
:ls_zhuanj,
:ls_guahf,
:ls_caozy
) using sqlca;

execute myfun;
Fetch myfun into :c2;
close myfun;
long ls_mzh,ls_update,ll_len,i,j
string ls_menzhenhao
select to_number(max(menzh)) into :ls_mzh from ghxx;
ls_menzhenhao=string(ls_mzh)
ll_len=len(string(ls_mzh))

for j=1 to 8 - ll_len
   ls_menzhenhao="0"+ls_menzhenhao
next
dw_1.scrolltorow(1)
for i=1 to dw_1.rowcount( )
dw_1.setitem(dw_1.getrow(), "menzh", string(ls_menzhenhao))
dw_1.setitem(dw_1.getrow(), "xuh", "01")
dw_1.setitem(dw_1.getrow(), "mingxh", string(dw_1.getrow( )))
dw_1.setitem(dw_1.getrow(), "menzh", string(ls_menzhenhao))
dw_1.setitem(dw_1.getrow(), "chufh", "1")
dw_1.setitem(dw_1.getrow(), "yijzx", "×")
dw_1.setitem(dw_1.getrow(), "yijtf", "×")
dw_1.setitem(dw_1.getrow(), "zkl", 1.00)
dw_1.setitem(dw_1.getrow(), "fus", 1)
dw_1.scrollnextrow( )
next
//掛號資訊需要插入的資料有:menzh,xuh,faph,fukfs,lurrq,caozy,yijsf,shouksj,shoukr
string ls_sysdate //lurrq,shouksj 因為程式只要列印發票,錄入的時間就是收款的時間
select  to_char(sysdate,'yyyy-mm-dd,hh:mm:ss') into :ls_sysdate from dual;
insert into mzhj
(menzh,xuh,faph,fukfs,lurrq,caozy,yijsf,shouksj,shoukr)
values
(
:ls_menzhenhao,
'01',
'',
'現金',
:ls_sysdate,
:gl_code,
'√',
:ls_sysdate,
:gl_code
);
commit using sqlca;

long ll_update
ll_update=dw_1.update( )
if ll_update<>1 then
messagebox("系統提示","資料儲存失敗")
rollback;
return;
end if
commit;
string ls_ghxx
select max(ghxx.menzh) into:ls_ghxx from  ghxx for update ; //鎖ghxx表,當多個客戶機同時修改表時,鎖定表,該條資料儲存後,方可解鎖
commit;  //解鎖
ib_new=false
//建立動態資料視窗,列印發票
datastore fp_print
fp_print=create datastore
fp_print.dataobject="db_free_fp"
fp_print.settransobject(sqlca);
//......................................................................................//
//取患者姓名,流水號,伺服器時間,操作員
string ls_hname,ls_liush,ls_serverdate,ls_cname
ls_hname=trim(sle_2.text)
select max(menzh) into :ls_liush from v_mzhjmx using sqlca;
select  to_char(sysdate,'yyyy-mm-dd') into :ls_serverdate from dual;
ls_cname=gl_username
dw_2.retrieve()
long ll_rowcount,ll_dw_2_insert
integer k,li_getrow,li_setnull
setnull(li_setnull)
string ls_fenl,ls_ksmc
decimal ld_jine,ld_xiaox
ll_rowcount=dw_2.rowcount()
ll_dw_2_insert=fp_print.insertrow(0)
for k=1 to ll_rowcount
 ls_fenl=dw_2.getitemstring(dw_2.getrow(),"fenl")
 ls_ksmc=dw_2.getitemstring(dw_2.getrow(),"kesmc")
 ld_jine=round(dw_2.getitemdecimal(dw_2.getrow(),"jine"),2)
   fp_print.setitem(ll_dw_2_insert,"type1",ls_fenl)
 fp_print.setitem(ll_dw_2_insert,"type2",ls_ksmc)
 fp_print.setitem(ll_dw_2_insert,"type3",ld_jine)
 fp_print.setitem(ll_dw_2_insert,"xingm",ls_hname)
 fp_print.setitem(ll_dw_2_insert,"liush",ls_liush)
 fp_print.setitem(ll_dw_2_insert,"systime",ls_serverdate)
 fp_print.setitem(ll_dw_2_insert,"caozy",ls_cname)
 fp_print.setitem(ll_dw_2_insert, "type4","")
 fp_print.setitem(ll_dw_2_insert, "type5","作廢")
 fp_print.setitem(ll_dw_2_insert, "type6",li_setnull)
 fp_print.setitem(ll_dw_2_insert, "type7","")
 fp_print.setitem(ll_dw_2_insert, "type8","作廢")
 fp_print.setitem(ll_dw_2_insert, "type9",li_setnull)
 if dw_2.getrow()=ll_rowcount then
  ld_xiaox=round(fp_print.getitemdecimal(ll_dw_2_insert, "type3"),1)
  fp_print.setitem(ll_dw_2_insert,"xiaox",string(ld_xiaox))
   fp_print.print()
       exit
   end if
 dw_2.scrollnextrow()
 ls_fenl=dw_2.getitemstring(dw_2.getrow(),"fenl")
 ls_ksmc=dw_2.getitemstring(dw_2.getrow(),"kesmc")
 ld_jine=round(dw_2.getitemdecimal(dw_2.getrow(),"jine"),2)
 fp_print.setitem(ll_dw_2_insert,"type4",ls_fenl)
 fp_print.setitem(ll_dw_2_insert,"type5",ls_ksmc)
 fp_print.setitem(ll_dw_2_insert,"type6",ld_jine)
   fp_print.setitem( ll_dw_2_insert, "type7","")
 fp_print.setitem( ll_dw_2_insert, "type8","作廢")
 fp_print.setitem( ll_dw_2_insert, "type9",li_setnull)
 if dw_2.getrow()=ll_rowcount then
     fp_print.print()
    exit
   end if
 
 dw_2.scrollnextrow()
 ls_fenl=dw_2.getitemstring(dw_2.getrow(),"fenl")
 ls_ksmc=dw_2.getitemstring(dw_2.getrow(),"kesmc")
 ld_jine=round(dw_2.getitemdecimal(dw_2.getrow(),"jine"),2)
 fp_print.setitem(ll_dw_2_insert,"type7",ls_fenl)
 fp_print.setitem(ll_dw_2_insert,"type8",ls_ksmc)
 fp_print.setitem(ll_dw_2_insert,"type9",ld_jine)
 fp_print.print()
 if dw_2.getrow()=ll_rowcount then
   exit
   end if
 dw_2.scrollnextrow()
 next
   fp_print.setitem(ll_dw_2_insert, "type1",li_setnull)
 fp_print.setitem(ll_dw_2_insert, "type2",li_setnull)
 fp_print.setitem(ll_dw_2_insert, "type3",li_setnull)
   fp_print.setitem(ll_dw_2_insert, "type4",li_setnull)
 fp_print.setitem(ll_dw_2_insert, "type5",li_setnull)
 fp_print.setitem(ll_dw_2_insert, "type6",li_setnull)
 fp_print.setitem(ll_dw_2_insert, "type7",li_setnull)
 fp_print.setitem(ll_dw_2_insert, "type8",li_setnull)
 fp_print.setitem(ll_dw_2_insert, "type9",li_setnull)
 fp_print.setitem(ll_dw_2_insert,"liush",li_setnull)
 fp_print.setitem(ll_dw_2_insert,"systime",li_setnull)
 fp_print.setitem(ll_dw_2_insert,"caozy",li_setnull)
 destroy fp_print
 messagebox("系統提示","資料儲存並列印完畢!")
 
//dw_2.retrieve( )
//dw_2.print( )

相關文章