⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 w_more.pas

📁 适合行业为眼镜业
💻 PAS
📖 第 1 页 / 共 2 页
字号:
        superdatagrid1.Cells[3,0]:=w_form1[2] ;
        label9.Caption:='现金费用单';
        w_morefm.Caption:='现金费用单';
        edit5.Visible:=false;
        label6.Visible:=false;
        BtnSelPayAccount.Visible:=false;
        szAccountId2:='0000100003';//现金帐户
        szAccountName2:='现  金';
        Edit5.Text:='现  金';
        if editmode=0 then
        begin
          sqls:='select max(right(BillCode,4)) from maintable where BillType=801 and BillDate='+''''+trim(formatdatetime('yyyy-mm-dd',date))+''''+' and shopNo='+''''+trim(shopid)+'''';
          make:='XJFY-'+trim(Handle_Part)+trim(handle_no);
          edit2.Text:=setcode(SQLS,make);
        end;
      end;
  2,6,9: begin
       superdatagrid1.Cells[1,0]:=w_form2[0] ;
       superdatagrid1.Cells[2,0]:=w_form2[1] ;
       superdatagrid1.Cells[3,0]:=w_form2[2] ;
       if w_formid=2 then
       begin
         label9.Caption:='一般费用单';
         w_morefm.Caption:='一般费用单';
       end ;
       if w_formid=6 then
       begin
         label9.Caption:='应付款增加';
         w_morefm.Caption:='应付款增加';
       end;
       if w_formid=9 then
       begin
         label9.Caption:='应收款减少';
         w_morefm.Caption:='应收款减少';
       end;
       label3.caption:='收款单位';
       if editmode=0 then
       begin
        sqls:='select max(right(BillCode,4)) from maintable where BillType=802 and BillDate='+''''+trim(formatdatetime('yyyy-mm-dd',date))+''''+' and shopNo='+''''+trim(shopid)+'''';
        make:='YBFY-'+trim(Handle_Part)+trim(handle_no);
        edit2.Text:=setcode(SQLS,make);
       end;
     end;
   3,7,8: begin
       superdatagrid1.Cells[1,0]:=w_form3[0] ;
       superdatagrid1.Cells[2,0]:=w_form3[1] ;
       superdatagrid1.Cells[3,0]:=w_form3[2] ;
       if w_formid=3 then
       begin
         label9.Caption:='其它收入单';
         w_morefm.Caption:='其它收入单';
       end;
       if w_formid=7 then
       begin
         label9.Caption:='应收款增加';
         w_morefm.Caption:='应收款增加';
       end;
       if w_formid=8 then
       begin
         label9.Caption:='应付款减少';
         w_morefm.Caption:='应付款减少';
       end;
       label6.Caption:='收款帐户';
       label3.caption:='付款单位';
      if editmode=0 then
      begin
        sqls:='select max(right(BillCode,4)) from maintable where BillType=803 and BillDate='+''''+trim(formatdatetime('yyyy-mm-dd',date))+''''+' and shopNo='+''''+trim(shopid)+'''';
        make:='QTFY-'+trim(Handle_Part)+trim(handle_no);
        edit2.Text:=setcode(SQLS,make);
      end;
     end;
   4: begin
        superdatagrid1.Cells[1,0]:=w_form7[0] ;
        superdatagrid1.Cells[2,0]:=w_form7[1] ;
        superdatagrid1.Cells[3,0]:=w_form7[2] ;
        label9.Caption:='待摊费用发生单';
        w_morefm.Caption:='待摊费用发生单';
        edit5.Visible:=false;
        label6.Visible:=false;
        BtnSelPayAccount.Visible:=false;
        szAccountId2:='0000100007';
        szAccountName2:='待摊费用';
        Edit5.Text:='待摊费用';
        label3.caption:='发生部门';
        if editmode=0 then
        begin
          sqls:='select max(right(BillCode,4)) from maintable where BillType=804 and BillDate='+''''+trim(formatdatetime('yyyy-mm-dd',date))+''''+' and shopNo='+''''+trim(shopid)+'''';
          make:='DTFS-'+trim(Handle_Part)+trim(handle_no);
          edit2.Text:=setcode(SQLS,make);
        end;
      end;
   5: begin
        superdatagrid1.Cells[1,0]:=w_form8[0] ;
        superdatagrid1.Cells[2,0]:=w_form8[1] ;
        superdatagrid1.Cells[3,0]:=w_form8[2] ;
        label9.Caption:='待摊费用摊销单';
        w_morefm.Caption:='待摊费用摊销';
        edit5.Visible:=false;
        label6.Visible:=false;
        BtnSelPayAccount.Visible:=false;
        szAccountId2:='0000100007';//现金帐户
        szAccountName2:='待摊费用';
        Edit5.Text:='待摊费用';
        label3.caption:='摊销单位';
        if editmode=0 then
        begin
          sqls:='select max(right(BillCode,4)) from maintable where BillType=805 and BillDate='+''''+trim(formatdatetime('yyyy-mm-dd',date))+''''+' and shopNo='+''''+trim(shopid)+'''';
          make:='DTTX-'+trim(Handle_Part)+trim(handle_no);
          edit2.Text:=setcode(SQLS,make);
        end;
      end;
 end;

 if czShowmode='Edit' then
 begin
    ReadData;
    RefreshTotal;
 end;
 FormShowMode;
 Screen.Cursor:=crDefault;
end;

procedure Tw_morefm.BtnSelCheckClick(Sender: TObject);
var
 cztext :string;
begin
  if czShowMode = 'ReadOnly' then exit;
  perform(WM_NEXTDLGCTL,0,0);
  Employe_Check:='';
  Employe_Check:='Storage_Umanage_Fad';
  Employe_Check_Result:='';
  frm_Login_Man:=Tfrm_Login_Man.Create(self);
  frm_Login_Man.Caption:='经手人选择';
  frm_Login_Man.ShowModal;
  checkedit.Text := Employe_Check_Result;

end;

procedure Tw_morefm.Edit3Enter(Sender: TObject);
begin
  if czShowMode = 'ReadOnly' then exit;
  szEnterText:=(sender as TEdit).text;
end;

procedure Tw_morefm.SuperDataGrid1KeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
 if czShowMode = 'ReadOnly' then exit;
 if (key = vk_Delete) and ((SuperDataGrid1.col=1) or (SuperDataGrid1.col=2)) and
    (SuperDataGrid1.Cells[1,SuperDataGrid1.row]='') then
     begin
        DelRow(SuperDataGrid1,SuperDataGrid1.Row);
        DelRow(StringGrid1,SuperDataGrid1.Row);
     end;
 if (Key = VK_RETURN) then
 begin
   if SuperDataGrid1.RowCount<SuperDataGrid1.Row+2 then
      begin
        SuperDataGrid1.RowCount:=SuperDataGrid1.RowCount+1;
        StringGrid1.RowCount:=SuperDataGrid1.RowCount;
        RefreshOrd(SuperDataGrid1);
      end;
   if (SuperDataGrid1.col=3) then
      begin
        SuperDataGrid1.col:=4;
        if (SuperDataGrid1.Cells[1,SuperDataGrid1.row]<>'') and
           (SuperDataGrid1.Cells[3,SuperDataGrid1.row]='') then
            SuperDataGrid1.Cells[3,SuperDataGrid1.row]:='0';
      end
   else if (SuperDataGrid1.col=4) then
      begin
         SuperDataGrid1.col:=1;
         SuperDataGrid1.Row:=SuperDataGrid1.Row+1;
      end
   else if ((SuperDataGrid1.col=1) or (SuperDataGrid1.col=2))  then
      begin
        SuperDataGrid1.col:=3;
        ShowAccountWin(SuperDataGrid1.row);//选择会计科目。
      end;
    end;
end;

procedure Tw_morefm.SuperDataGrid1BeforeEdit(Sender: TObject; col,
  row: Integer);
begin
  if czShowMode = 'ReadOnly' then exit;
  szEnterText:=SuperDataGrid1.Cells[col,row];
end;

procedure Tw_morefm.Edit3KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var
  czText : string;
begin
  if Key=VK_RETURN then
  begin
    if czShowMode = 'ReadOnly' then exit;
    edit3.SetFocus;
  end;
end;

procedure Tw_morefm.EditDomanKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key=VK_RETURN then
  begin
    if czShowMode = 'ReadOnly' then exit;
  end;
end;

procedure Tw_morefm.SuperDataGrid1DblClick(Sender: TObject);
begin
  if czShowMode = 'ReadOnly' then exit;
  if ((SuperDataGrid1.col=1) or (SuperDataGrid1.col=2)) then
    if ShowaccountWin(SuperDataGrid1.row)=0 then
    begin
    end else
      szEnterText:=SuperDataGrid1.Cells[SuperDataGrid1.col,SuperDataGrid1.row];
end;

function Tw_morefm.writeMainBill:integer;
var nret:integer;
begin
  case w_Formid of
    1:lbilltype:=801;
    2,6,9:lbilltype:=802;
    3,7,8:lbilltype:=803;
    4:lbilltype:=804;
    5:lbilltype:=805;
  end;
  try
    ipubtemp.WriteMainBill(Edit2.text,lbilltype,
            formatdatetime('YYYY-MM-DD',MaskEdit1.Date),BillEEdit.Text, CheckEdit.text,EditDoman.Text,szUnitId,//往来单位编号
            edit3.text,strtofloat(TotalMoneyTb.Caption),0,0,shopid,Edit6.Text,nret,editmode,BillID);
    lnewNumberId:=nret;
   except
   end;


    result:=nret;
end;

function   Tw_morefm.writeDetailBill:integer;  //写明细表。
var nret,i:Integer;
begin
  for i:=1 to  SuperDataGrid1.RowCount-1 do
    begin
        if   SuperDataGrid1.Cells[1,i]='' then Break;
        ipubtemp.LQ_WriteFinanceBill(lnewNumberId,lbilltype,
            formatdatetime('YYYY-MM-DD',MaskEdit1.Date),StringGrid1.Cells[1,i],SuperDataGrid1.Cells[2,i],szAccountId2,
            szAccountName2,strtofloat(SuperDataGrid1.Cells[3,i]),SuperDataGrid1.Cells[4,i],i,nret,Handle_Part,editmode);
       if nret=-1 then
         begin
           result:=nret;
           exit;
         end;
    end;
end;

function Tw_morefm.DeleteBill(billId:string):integer;
var
  sqlpub:widestring;
begin
 sqlpub:='delete MainTable where Billid='+billId;
try
   adisp.updatesql(sqlpub);
   result:=0;
except
   result:=-1;
end;
end;

procedure Tw_morefm.FormClose(Sender: TObject; var Action: TCloseAction);
var
  tempModalResult :TModalResult;
  szSql:string;
  nret:integer;
begin
  Action := caFree;
end;

function Tw_morefm.SaveDraft:boolean;
var
  szSql:string;
  //temp:widestring;
  datas:olevariant;
  result_billId:integer;
begin
   Result:=true;
   if CheckGrid=-1 then
      begin
         Result:=false;
         exit;
      end;
   if czShowMode='Edit' then
   begin
     if not bedit then
      begin
        if trim(Handle_Man)<>trim(Billeedit.Text) then
        begin
          Application.MessageBox('不能修改数据!',pchar(application.Title),mb_iconinformation);
          exit;
        end;
      end;
     end;
     result_billID:=writeMainBill ;
   if  result_billID= -1 then      //写主表
      begin
        Application.MessageBox('写主写失败,可能是网络忙!',pchar(application.title),mb_iconwarning);
        Result:=false;
        exit;
      end ;
          //////////////////////////写入草稿
  /////////////////////////
     result_billID:= writeDetailBill ;
   if result_billID=-1 then       //写明细表;
      begin
        Application.MessageBox('写明细表失败,可能是网络忙!',pchar(application.title),mb_iconwarning);
        Result:=false;
        exit;
      end else
      begin
        try
         if czShowMode<>'Edit' then
         begin
          dmmain.cdsReceipt.close;
          dmmain.cdsReceipt.Open;
          dmmain.cdsReceipt.Append;
          dmmain.cdsReceipt.FieldByName('Receipt_NO').AsString:=Trim(edit2.Text);
          dmmain.cdsReceipt.FieldByName('Receipt_Name').AsString:=trim(label9.caption);
          dmmain.cdsReceipt.FieldByName('Copy_Date').AsString:=formatdatetime('yyyy''-''mm''-''dd',date);
          dmmain.cdsReceipt.FieldByName('Proposer').AsString:=Trim(billeedit.text);
          dmmain.cdsReceipt.FieldByName('Check_Result').Asinteger:=0;
          dmmain.cdsReceipt.FieldByName('Flag_Sign').AsString:='草稿';
          dmmain.cdsReceipt.FieldByName('Condense').AsString:=trim(edit6.text);
          dmmain.cdsReceipt.FieldByName('Re_part').AsString:=trim(Handle_Part);
          dmmain.cdsReceipt.Post;
          dmmain.cdsReceipt.ApplyUpdates(-1);
         end;
       except
       end;
      end;
   FormClear;
end;

procedure Tw_morefm.BtnSelPayAccountClick(Sender: TObject);
begin
    szAccountId2:='00001';
    AccountSelectShow(szUserCode2,szAccountId2,szAccountName2,'1');
    Edit5.text:= szAccountName2;
end;

procedure Tw_morefm.BitBtn1Click(Sender: TObject);
begin
SuperDataGrid1.RowCount:=SuperDataGrid1.RowCount+1;
RefreshOrd(SuperDataGrid1);
end;

procedure Tw_morefm.BitBtn3Click(Sender: TObject);
begin
 DelRow( SuperDataGrid1,SuperDataGrid1.Row);
 RefreshTotal;
end;

procedure Tw_morefm.SuperDataGrid1KeyPress(Sender: TObject; var Key: Char);
var n:double;
begin
  if key=#8 then exit;
  if SuperDataGrid1.col=3 then
    if not TryStrToFloat(key,n) then key:=#0;
end;

procedure Tw_morefm.SuperDataGrid1KeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  IF SuperDataGrid1.col=3 then RefreshTotal;
end;

procedure Tw_morefm.BtnSelDomanClick(Sender: TObject);
begin
  if czShowMode = 'ReadOnly' then exit;

 Employe_Check:='';
  Employe_Check:='Storage_Umanage_Fad';
  Employe_Check_Result:='';
  frm_Login_Man:=Tfrm_Login_Man.Create(self);
  frm_Login_Man.Caption:='经手人选择';
  frm_Login_Man.ShowModal;
  editdoman.Text := Employe_Check_Result;

end;

procedure Tw_morefm.bitcheckClick(Sender: TObject);
var
  nret,i:integer;
  user:string;
  flag:olevariant;
  TotalMoney:double;
begin
  if not (lNumberID<>'') then exit;
  if trim(SuperDataGrid1.Cells[1,1])='' then exit;
  no:=trim(lNumberID);
  typed:=trim(label9.caption);
  user:=trim(Handle_No);
  flag:=adisp.receipted(no,typed,user,1,Handle_Part);
  if flag='3' then //
  begin
    try
       nret:=ipubtemp.EditMoney(BILLid,'');
       if nret=-1 then flag:='2' else flag:='3';
       if w_formid>5 then
       begin
         totalMoney:=0;
         for i:=1 to superdatagrid1.RowCount-1 do
         begin
           totalMoney:=TotalMoney+strtofloat(superdatagrid1.Cells[3,i]);
         end;
       end;
      if flag='3' then
      begin
         if w_formid=6 then  ///////////应付增加减少
         begin
           ipubtemp.Gether(szUnitId,totalmoney,1,1);
         end;
         if w_formid=8 then
         begin
           ipubtemp.Gether(szUnitId,totalmoney,1, 0);
         end;
          if w_formid=7 then  ///////////应手增加减少
         begin
           ipubtemp.Gether(szUnitId,totalmoney,0,1);
         end;
         if w_formid=9 then
         begin
           ipubtemp.Gether(szUnitId,totalmoney,0, 0);
         end;
      end;
    except
      application.MessageBox('服务器发生故障!',pchar(application.Title),mb_iconwarning);
      exit;
    end;
    ////////////////////
  end;
  if flag='1' then
  begin
    application.MessageBox('审核成功!',pchar(application.Title),mb_iconinformation);
    close;
    exit;
  end;
  if flag='2' then
  begin
    application.MessageBox('无权进行进行审核',pchar(application.Title),mb_iconinformation);
    exit;
  end;
  if flag='3' then
  begin
    application.MessageBox('审核完毕!',pchar(application.Title),mb_iconinformation);
    close;
    //exit;
  end;
  if flag='4' then
  begin
    application.MessageBox('反审核完毕!',pchar(application.Title),mb_iconinformation);
    exit;
  end;
  if flag='5' then
  begin
    application.MessageBox('反审核成功!',pchar(application.Title),mb_iconinformation);
    exit;
  end;
  if flag='6' then
  begin
    application.MessageBox('单据过帐后,不能进行审核或反审核!',pchar(application.Title),mb_iconinformation);
    exit;
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -