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

📄 frm_allexportbilledit.pas

📁 这是一个基于delphi平台的物流空运管理系统!
💻 PAS
📖 第 1 页 / 共 5 页
字号:
end;

procedure TFrmAllExportBillEdit.SaveHawbparpay;
var
  sqlstr,Varfendan:string;
  yunFare,zaFare:real;
  PPd,coll,oppd,ocoll:string;
  ZaDes:String;
begin
  PPd:='';coll:='';oppd:='';ocoll:='';
  {Select 出主单中所包括的所有分单数据}
  Query1.close;
  Query1.sql.text:='select * from Filetable  '+
   ' where Maincode='''+varmain+'''';
  query1.open;

   while not query1.Eof do
     begin
       Varfendan:=query1.fieldbyname('Filecode').Asstring; {记录分单的FileCode号}
       yunFare:=0;zaFare:=0;
       PPd:='';coll:='';oppd:='';ocoll:='';

   {统计分单运费}
     {
     qrytemp.close;
     qrytemp.sql.text:='select Sum(total) as yun from planegoods  '+
      ' where Filecode='''+Varfendan+''' ';
     qrytemp.open;
     }
     qrytemp.close;
     qrytemp.sql.text:='select Sum(Acount) as yun from Fareinfo  '+
     ' where Filecode='''+Varfendan+''' and  goodscode=''运费'' '+
     ' and OperCwMark=''业务操作''';
     qrytemp.open;
     yunFare:=qrytemp.fieldbyname('yun').asfloat;  {记录运费金额}

    {统计分单杂费}
     qrytemp.close;
     qrytemp.sql.text:='select Sum(Acount) as zafare from Fareinfo  '+
     ' where Filecode='''+Varfendan+''' and  goodscode=''杂费'''+
     ' and OperCwMark=''业务操作''';
     qrytemp.open;
     zaFare:=qrytemp.fieldbyname('zafare').asfloat;

    {统计分单的杂费的合计信息}
     qrytemp.close;
     qrytemp.sql.text:='select a.acount,b.name,c.farecname,c.farename'+
       ' from Fareinfo a,currency b,fareinformation c '+
       ' where b.code=*a.currencytype and c.farecode=*a.farecode and '+
        ' a.Filecode='''+Varfendan+''' and  a.goodscode=''杂费'' '+
        ' and a.OperCwMark=''业务操作''';
     qrytemp.open;
     ZaDes:='';
     while not qrytemp.Eof do
       begin
//          zades:=qrytemp.fieldbyname('farename').asstring+':'+trim(qrytemp.fieldbyname('name').asstring+' '+floattostr(qrytemp.fieldbyname('acount').asfloat));
          zades:=zades+qrytemp.fieldbyname('farename').asstring+'  '+FloatTOstrF(qrytemp.fieldbyname('acount').asfloat,ffFixed,16,2)+chr(13);
          qrytemp.next;
       end;
     sqlstr:='update Filetable set otherdesc='''+FrmMain.fullstryh(zades)+''' where Filecode='''+Varfendan+'''  ';
     if FrmMain.ExecSQL(sqlstr) then
     else
        ShowMessage('统计分单杂费费用的项数时出错,请检查!');

     {得到预付到付的标记}
      qrytemp.close;
      qrytemp.sql.text:='select * from Filetable  '+
       ' where Filecode='''+Varfendan+''' ';
      qrytemp.open;
      PPd:=qrytemp.fieldbyname('PPd').asstring;
      coll:=qrytemp.fieldbyname('coll').asstring;
      oppd:=qrytemp.fieldbyname('oppd').asstring;
      ocoll:=qrytemp.fieldbyname('ocoll').asstring;

     {保存到分单中的运费,杂费,预付到付信息}
    if PPd='PP' then
     begin
       {PrePay 运费预付,DPay 运费到付  TOCPre 杂费预付  TOCCollect 杂费到付}
       if oppd='PP' then
          sqlstr:='update Filetable set prepay='+Floattostr(yunFare)+',Dpay=0,Tocpre='+floattostr(zaFare)+',TocCollect=0,Pretotal='+floattostr(zaFare+yunfare)+',Dtotal=0  where Filecode='''+varfendan+'''  ';
       if ocoll='CC' then
          sqlstr:='update Filetable set prepay='+floattostr(yunFare)+',Dpay=0,Tocpre=0,TocCollect='+floattostr(zaFare)+',Pretotal='+floattostr(yunfare)+',Dtotal='+floattostr(zaFare)+' where Filecode='''+varfendan+'''';
     end;
   if coll='CC' then
      begin
        if oppd='PP' then
          sqlstr:='update Filetable set prepay=0,Dpay='+floattostr(yunFare)+',Tocpre='+floattostr(zaFare)+',TocCollect=0,Pretotal='+floattostr(zafare)+',Dtotal='+floattostr(yunFare)+' where Filecode='''+varfendan+'''';
        if ocoll='CC' then
          sqlstr:='update Filetable set prepay=0,Dpay='+floattostr(yunFare)+',Tocpre=0,TocCollect='+floattostr(zaFare)+',Pretotal=0,Dtotal='+floattostr(yunFare+zafare)+' where Filecode='''+varfendan+'''';
      end;

       if FrmMain.ExecSQL(sqlstr) then
       else
          ShowMessage('分单运费,杂费预付到付数据统计失败,请检查');
     Query1.Next;
  end;
  Query1.close;
end;

function TFrmAllExportBillEdit.Havefendan:boolean;
var
  FilterStr:string;
begin
  result:=false;
  QryTemp2.Close;
  QryTemp2.SQL.Text:='Select * fareinfo Where Form Filecode='''+lvhw.selected.caption+''' and substring(relacode,1,1)=''F''';
  QryTemp2.Open;
  if FrmMain.RecordCount(QryTemp2)>0 then
     result:=true;
end;

procedure TFrmAllExportBillEdit.ClearSG;
var
   count2:integer;
   count:integer;
begin
  inherited;
  if SG.RowCount=2 then
    For Count2:= 0 to 13 do
       SG.Cells[Count2,1]:= ''
  else
    begin
      For Count:=1 to SG.RowCount-1 do
         For Count2:= 0 to 13 do
            SG.Cells[Count2,Count]:='';
       SG.RowCount :=2;
    end;
end;

procedure TFrmAllExportBillEdit.ClearSG2;
var
   count2:integer;
   count:integer;
begin
  inherited;
  if SG2.RowCount=2 then
    For Count2:= 0 to 13 do
       SG2.Cells[Count2,1]:= ''
  else
    begin
      For Count:=1 to SG2.RowCount-1 do
         For Count2:= 0 to 13 do
            SG2.Cells[Count2,Count]:='';
       SG2.RowCount :=2;
    end;
end;

Constructor TFrmAllExportBillEdit.CreateFromP(Edit:Boolean;Lone:Boolean;Code:string;Sender: TComponent);
var
   QueryStr:string;
begin
  inherited
  {检查完毕}
  Create(Sender);

  shortDateFormat:='yyyy-mm-dd';
  Page.ActivePage :=MAWB;
 {初始化时,把费用和操作都不要显示出来}
  CHARGE.TabVisible :=false;
  {主单是编辑还是增加}
  IsEdit:=Edit;  {传参过来,编辑与增加}
  Alone:=Lone;
  VarMain:=Code; {传参过来,主单号}
  VarHawb:='';   {初始的时候,分单号是为空的}
  execdate.date:=date;
{如果编辑客户的按钮没有打开}

  VoyageDate.datetime:=date;
  CVoyageDate.datetime:=date;

  {操作人}
  Edtczr.text:=FrmMain.LoginName ;  {主单的操作人}
  Cedtczr.text:=FrmMain.LoginName ; {分单的操作人}

  HappenDate.datetime:=date; {费用中的截至日期}
  DoDate.datetime:=date;   {操作日期}
  ExecDate.datetime:=date;  {主单签单日期}
  cExecDate.datetime:=date; {分单签单日期}

  ColLast:=0; {主单当前货物列}
  RowLast:=1; {主单当前货物列}
  cColLast:=0; {分单当前货物列}
  cRowLast:=1; {分单当前货物列}
  gISChange:=false;  {主单货物数据改变}
  cgISChange:=false;  {分单货物数据改变}
  inserted:=false; {是否处于插入记录状态}
  cFIsEdit:=False;

  if Screen.Width > 700 then
    begin
      SG.DefaultRowHeight:=16;
      SG2.DefaultRowHeight:=16;
    end
  else
    begin
      SG.DefaultRowHeight:=16;
      SG2.DefaultRowHeight:=16;
    end;

  SG.ColWidths[0]:=45; {件数}
  SG.ColWidths[1]:=45;  {重量}
  SG.ColWidths[2]:=60; {单位}
  SG.ColWidths[3]:=50;  {货物体积}
  SG.ColWidths[4]:=50;  {费用等级}
  SG.ColWidths[5]:=100;  {公式}
  SG.ColWidths[6]:=80;  {计费重量}
  SG.ColWidths[7]:=80;  {单价}
  SG.ColWidths[8]:=90;   {费用}
  SG.ColWidths[9]:=200; {货物描述}
  SG.ColWidths[10]:=0;
  SG.ColWidths[11]:=0;
  SG.ColWidths[12]:=180;  {C.M.I}
  SG.ColWidths[13]:=0;   {}
{件数  重量  单位  体积  等级  公式  }
{计费重量  单价  费用  货物描述  编号 编号  C.M.I  一个 }

  SG.Cells[0,0]:='件数';
  SG.Cells[1,0]:='重量';
  SG.Cells[2,0]:='单位';
  SG.Cells[3,0]:='体积';
  SG.Cells[4,0]:='等级';
  SG.Cells[5,0]:='公式';
  SG.Cells[6,0]:='计费重量';
  SG.Cells[7,0]:='单价';
  SG.Cells[8,0]:='费用';
  SG.Cells[9,0]:='货物描述';
  SG.Cells[12,0]:='其他描述';
  SG.Cells[13,0]:='';


  SG2.ColWidths[0]:=45; {件数}
  SG2.ColWidths[1]:=45;  {重量}
  SG2.ColWidths[2]:=60; {单位}
  SG2.ColWidths[3]:=50;  {货物体积}
  SG2.ColWidths[4]:=50;  {费用等级}
  SG2.ColWidths[5]:=100;  {公式}
  SG2.ColWidths[6]:=80;  {计费重量}
  SG2.ColWidths[7]:=80;  {单价}
  SG2.ColWidths[8]:=90;   {费用}
  SG2.ColWidths[9]:=200; {货物描述}
  SG2.ColWidths[10]:=0;
  SG2.ColWidths[11]:=0;
  SG2.ColWidths[12]:=180;  {C.M.I}
  SG2.ColWidths[13]:=0;   {}

   SG2.Cells[0,0]:='件数';
   SG2.Cells[1,0]:='重量';
   SG2.Cells[2,0]:='单位';
   SG2.Cells[3,0]:='体积';
   SG2.Cells[4,0]:='等级';
   SG2.Cells[5,0]:='公式';
   SG2.Cells[6,0]:='计费重量';
   SG2.Cells[7,0]:='单价';
   SG2.Cells[8,0]:='费用';
   SG2.Cells[9,0]:='货物描述';
   SG2.Cells[12,0]:='其他描述';
   SG2.Cells[13,0]:='';
{件数,重量,单位,体积,等级,公式,计费重量,单价,费用,货物描述,编号,编号,CMI,DD}

   FrmMain.AddColumn(LVHW,'',1);
   FrmMain.AddColumn(LVHW,'工作单号',100);
   FrmMain.AddColumn(LVHW,'分运单号',100);
   FrmMain.AddColumn(LVHW,'发货人',100);
   FrmMain.AddColumn(LVHW,'品名',80);
   FrmMain.AddColumn(LVHW,'件数',40);
   FrmMain.AddColumn(LVHW,'重量',40);
   FrmMain.AddColumn(LVHW,'体积',40);

   FrmMain.AddColumn(LVFare,'自动编号',0);
   FrmMain.AddColumn(LVFare,'费用对象',200);
   FrmMain.AddColumn(LVFare,'费用名称',100);
   FrmMain.AddColumn(LVFare,'应收',80);
   FrmMain.AddColumn(LVFare,'应付',80);
   FrmMain.AddColumn(LVFare,'币种',80);

   FrmMain.AddColumn(LVDDO,'',1);
   FrmMain.AddColumn(LVDDO,'操作时间',100);
   FrmMain.AddColumn(LVDDO,'操作内容',250);
   FrmMain.AddColumn(LVDDO,'操作结果',200);


  {交接单号,已经确认并且日期在一个月以前}
  QueryStr:='select a.*,b.custcname from custquote a,customerinfo b '+
          ' where  b.cuscode=*a.askpriceman and priceenter=1 and a.planeship=1 and a.outin=0 and '+
          ' a.quotedate>='''+datetimetostr(int(Strtodatetime(FrmMain.DateStart)-30))+'''';
  FrmMain.Full_FilterCombobox(ComPrice,QueryStr,'quotecode','jjcode','custcname');
  FrmMain.Full_FilterCombobox(cComPrice,QueryStr,'quotecode','jjcode','custcname');

  {收入科目}
  Querystr:='select * from faretype where beprofit=1 ';
  FrmMain.Full_FilterCombobox(Comkmdm,querystr,'farecode','cname');
  FrmMain.Full_FilterCombobox(ComZCkmdm,querystr,'farecode','cname');
  FrmMain.Full_FilterCombobox(cComkmdm,querystr,'farecode','cname');
  FrmMain.Full_FilterCombobox(cComZCkmdm,querystr,'farecode','cname');
  {公式,空运的公式}
  QueryStr:='Select * from Formula where planeocean=1';
  FrmMain.Full_FilterCombobox(comformula,QueryStr,'code','descript');
  FrmMain.Full_FilterCombobox(Ccomformula,QueryStr,'code','descript');

  {航空公司}
  querystr:='select * from shipcompany where Mark=''空运'' ';
  FrmMain.Full_FilterCombobox(comshipcom,querystr,'shipcomcode','shipcomcname');
  FrmMain.Full_FilterCombobox(ccomshipcom,querystr,'shipcomcode','shipcomcname');

  {港口代码}
   querystr:='select * from Portinfo where planeocean=''空运'' or planeocean=''海运空运''';
   FrmMain.Full_FilterCombobox(comload,QueryStr,'portcode','portname');
   FrmMain.Full_FilterCombobox(comunload,QueryStr,'portcode','portname');

   FrmMain.Full_FilterCombobox(ccomload,QueryStr,'portcode','portname');
   FrmMain.Full_FilterCombobox(ccomunload,QueryStr,'portcode','portname');

  {}
  querystr:='select * from customerinfo where planeocean=''空运'' or planeocean=''海运空运'' ';
  FrmMain.Full_FilterCombobox(ComYunCusCode,querystr,'cuscode','cusname');

 {发货人}
  querystr:='select * from customerinfo where planeocean=''空运'' or planeocean=''海运空运'' ';
  FrmMain.Full_FilterCombobox(comcuscode,querystr,'cuscode','custcname');
  FrmMain.Full_FilterCombobox(Ccomcuscode,querystr,'cuscode','custcname');

  {收货人}
  querystr:='select * from customerinfo where planeocean=''空运'' or planeocean=''海运空运'' ';
  FrmMain.Full_FilterCombobox(Comconsign,querystr,'cuscode','custcname');
  FrmMain.Full_FilterCombobox(cComconsign,querystr,'cuscode','custcname');

  {目的港代理}
  querystr:='select * from customerinfo where ((planeocean=''空运'' or planeocean=''海运空运'') and (synsign=''代理信息'')) ';
  FrmMain.Full_FilterCombobox(ComAgent,querystr,'cuscode','cusTcname');
  FrmMain.Full_FilterCombobox(cComAgent,querystr,'cuscode','cusTcname');

  {委托来源}
  querystr:='select * from customerinfo where (planeocean=''空运'' or planeocean=''海运空运'') ';
  FrmMain.Full_FilterCombobox(Comtrustsource,querystr,'cuscode','cusTcname');
  FrmMain.Full_FilterCombobox(cComtrustsource,querystr,'cuscode','cusTcname');

 {业务员}
  FrmMain.Full_Combobox(Bussiness,'bussinessman','code','name');
  FrmMain.Full_Combobox(cBussiness,'bussinessman','code','name');

 {委托类型}
  FrmMain.Full_ComboBox(Trusttype,'billTrustType','Code','Cname');
  FrmMain.Full_ComboBox(cTrusttype,'billTrustType','Code','Cname');
  {费用对象}
  querystr:='select * from customerinfo where planeocean=''空运'' or planeocean=''海运空运'' ';
  FrmMain.Full_FilterCombobox(ComBto,querystr,'cuscode','custcname');
  {费用名称信息}
  querystr:='select * from fareinformation where (planeship=1 or planeship=2) and (outin=''出口'' or outin=''出口进口'') ';
  FrmMain.Full_FilterCombobox(ComBname,querystr,'farecode','farecname');
  {费用类型信息}
  querystr:='select * from faretype where name=''操作员专用''';
  FrmMain.Full_FilterCombobox(CombType,querystr,'farecode','cname');
  {币种代码}
  FrmMain.full_combobox(ComCurrencyType,'Currency','Code','CName'); {费用币种}
  FrmMain.full_combobox(EdtCurr,'Currency','Code','CName'); {主单运费币种}
  FrmMain.full_combobox(CEdtCurr,'Currency','Code','CName');{分单运费币种}



  self.Top := 0;
  Self.Left := 0;

  {货物增加标志信息}
  goodsadd:=false;

  if IsEdit then
    begin
     try
       with QryTemp do
         begin
            close;
            sql.text:='select * from filetable where filecode ='''+VarMain+'''';
            open;
         end;
       if QryTemp.recordcount>0 then
         begin

         {FileCode}
         Varmain:=QryTemp.fieldbyName('Filecode').asstring;
         Edtfileno.text:=QryTemp.fieldbyName('MainCode').asstring;
         {fileno}

⌨️ 快捷键说明

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