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

📄 frm_allimportbilledit.~pas

📁 站长您好
💻 ~PAS
📖 第 1 页 / 共 5 页
字号:

      Frmmain.UpStr(sqlstr, 'ifdiscard', 0, ',');

      if chkkeydown.Checked then
        Frmmain.UpStr(sqlstr, 'keydown', 1, '')
      else
        Frmmain.UpStr(sqlstr, 'keydown', 0, '');

      Frmmain.UpStr(sqlstr, 'FileCode =', VarMain, 'w');

      if Frmmain.execsql(sqlstr) then
      begin
        SaveIfChecked;
      end
      else
      begin
        ShowMessage('主单记录操作有失误,记录保存失败,请检查!');
        exit;
      end;

      if Frmmain.IncludeValue('进口主单操作') then {锁定主单  完成标记}
      else
        if Chkkeydown.Checked then
          Chkkeydown.Enabled := false;

      {刷新LV}
{自动编号  FileNo   主单号  发货人,航次,代理名称,}
{品名,件数,重量,体积到达日期}

      ValueArray[0] := VarMain;
      ValueArray[1] := EdtRFileno.text;
      ValueArray[2] := '';
      ValueArray[3] := EdtFileno.text;
      ValueArray[4] := edtcuscodename.text;
      ValueArray[5] := EdtBy.text;
      ValueArray[6] := Frmmain.getfieldtext(comagent.text);
      ValueArray[7] := Edtgoods.text;
      ValueArray[8] := edtjianshu.text;
      ValueArray[9] := edttiji.text;
      ValueArray[10] := edtmaoz.text;
      ValueArray[11] := datetimetostr(int(execdate.date));
      ArrayCount := 11;
      Frmmain.RefeshOne(ValueArray, ArrayCount, FrmAllImportBillInfo.lv);
    except
      ShowMessage('主单记录修改后,不能够进行保存,请检查!');
    end;
  end
  else
  begin
    try
      {23}
      sqlstr := 'insert into FileTable(FileCode,MainCode,' +
        'Fileno,Stationcode,by1,agentcode,Cuscode,cuscodename,' +
        'shouhuoren,consignname,Agent,' +
        'goodsdesc,baozhuang,goodsnumber,goodssize,goodsweight,' +
        'goodschargeweight,' +
        'Execdate,Dexecdate,' +
        'befinish,keydown,ifzhidan,ifdiscard,operate,' +
        'inout) values(';
      {FileCode}
      Varmain := Frmmain.GetCode('K');
      Frmmain.InsStr(SqlStr, Varmain, ',');
      {Maincode}
      Frmmain.InsStr(sqlstr, EdtFileno.text, ',');
      {FileNo}
      Frmmain.InsStr(sqlstr, EdtRFileno.text, ',');
      {stationcode}
      Frmmain.InsStr(sqlstr, Frmmain.getfieldtext(comstation.Text), ',');
      {by1}
      Frmmain.InsStr(sqlstr, Edtby.text, ',');
      {代理商}
      Frmmain.InsStr(sqlstr, Frmmain.getfieldtext(Comagent.Text), ',');
      {cuscode}
      if comcuscode.text = '' then
        Frmmain.InsStr(sqlstr, 'null', ',')
      else
        Frmmain.InsStr(sqlstr, Frmmain.getfieldtext(Comcuscode.Text), ',');
      Frmmain.InsStr(sqlstr, edtcuscodename.Text, ',');
      {收货人}
      Frmmain.InsStr(sqlstr, Frmmain.getfieldtext(Comconsign.Text), ',');
      Frmmain.InsStr(sqlstr, edtconsignname.Text, ',');
      {Agent 通知方}
      Frmmain.InsStr(sqlstr, inform.lines.Text, ',');
      {货物描述}
      Frmmain.InsStr(sqlstr, edtGoods.Text, ',');
      {包装}
      Frmmain.InsStr(sqlstr, combaoz.text, ',');
      {件数}
      Frmmain.InsStr(sqlstr, strtoint(Edtjianshu.Text), ',');
      {体积}
      Frmmain.InsStr(sqlstr, strtofloat(Edttiji.Text), ',');
      {重量}
      Frmmain.InsStr(sqlstr, strtofloat(Edtmaoz.Text), ',');
      {计费重量}
      Frmmain.InsStr(sqlstr, strtofloat(Edtjfzl.Text), ',');
      {签定日期}
      Frmmain.InsStr(sqlstr, DatetimeTOStr(ExecDate.DateTime), ',');
      Frmmain.InsStr(sqlstr, DatetimeTOStr(int(ExecDate.DateTime)), ',');
      {Befinish 是否完成标记}
      if chkfinish.Checked then
        Frmmain.InsStr(sqlstr, 1, ',')
      else
        Frmmain.InsStr(sqlstr, 0, ',');

      if chkkeydown.Checked then
        Frmmain.InsStr(sqlstr, 1, ',')
      else
        Frmmain.InsStr(sqlstr, 0, ',');

      {直单标记}
      if Chkzhdan.Checked then
        Frmmain.InsStr(sqlstr, 1, ',')
      else
        Frmmain.InsStr(sqlstr, 0, ',');

      Frmmain.InsStr(sqlstr, 0, ',');
      Frmmain.InsStr(sqlstr, Frmmain.loginname, ',');
      {进出口标记 出口为1}
      Frmmain.InsStr(sqlstr, 0, '');
      if Frmmain.execsql(sqlstr) then
      else
      begin
        ShowMessage('主单操作有失误,记录不能够进行保存,请检查!');
        exit;
      end;
      {保存完毕以后,置于编辑状态}
      {FileCode Fileno  主单号 航次 代理名称}
      {装货港  到达日期}
      isedit := true;
      ValueArray[0] := Varmain;
      ValueArray[1] := EdtRFileno.text;
      ValueArray[2] := '';
      ValueArray[3] := EdtFileno.text;
      ValueArray[4] := edtcuscodename.text;
      ValueArray[5] := EdtBy.text;
      ValueArray[6] := Frmmain.getfieldtext(comagent.text);
      ValueArray[7] := Edtgoods.text;
      ValueArray[8] := edtjianshu.text;
      ValueArray[9] := edttiji.text;
      ValueArray[10] := edtmaoz.text;
      ValueArray[11] := datetimetostr(int(execdate.date));
      ArrayCount := 11;
      Frmmain.AddListView(ValueArray, ArrayCount, FrmAllImportBillInfo.lv);

    except
      ShowMessage('操作有失误,记录不能够进行保存,请检查!');
    end;
  end;
end;

procedure TFrmAllImportBillEdit.SpeedButton1Click(Sender: TObject);
begin
  inherited;
  if isedit then
  else
  begin
    ShowMessage('请先输入主单,并先保存主单数据再进行费用操作');
    exit;
  end;

  CHARGE.TabVisible := true; {显示费用界面}
  Page.ActivePage := CHARGE; {显示费用界面}
  Groupfare.Visible := true; {显示费用界面}
  BeConfirm := FrmMain.GetCustomerValue('Filecode', VarMain, 'ifprint',
    'FileTable');
  ShowFare(varmain);
  ShowHanding(varmain);

  {先预先把费用的增加、保存、删除按钮值为真}
  BitBtn4.Enabled := True;
  BitBtn6.Enabled := True;
  BitBtn11.Enabled := True;
  BitBtn18.Enabled := True;
  BitBtn23.Enabled := True;
  BitBtn24.Enabled := True;

  {如果不具有相应的权限,再把增加、保存、删除按钮值为假}
  if FrmMain.IncludeValue('进口费用浏览') then
  else
  begin
    BitBtn4.Enabled := false;
    BitBtn6.Enabled := false;
    BitBtn11.Enabled := false;
    BitBtn18.Enabled := false;
    BitBtn23.Enabled := false;
    BitBtn24.Enabled := false;
    exit;
  end;

  {如果不具有相应的权限,再把增加、保存、删除按钮值为假}
  if chkkeydown.Enabled then
  else
  begin
    BitBtn4.Enabled := false;
    BitBtn6.Enabled := false;
    BitBtn11.Enabled := false;
    BitBtn18.Enabled := false;
    BitBtn23.Enabled := false;
    BitBtn24.Enabled := false;
    exit;
  end;

  lblmess.Caption := '标志:编辑的为  主单的费用记录';

end;

procedure TFrmAllImportBillEdit.BitBtn1Click(Sender: TObject);
begin
  inherited;
  if chkkeydown.Enabled then
  else
  begin
    ShowMessage('该进口所属于的主单已确认,您所具有的权限已操作不了该进口记录!');
    exit;
  end;

  Cchkkeydown.Enabled := true;

  {把分单的增加或修改标记置为相应的值}
  cIsEdit := False;
  BitBtn1.Enabled := false;
  BitBtn3.Enabled := true;

  CedtFileno.text := '';
  CEdtrFileno.text := '';
  cinform.text := '';
  cBussiness.text := '';
  CChkfinish.checked := false;
  cchkkeydown.Checked := false;
  {件数}
  cEdtJianShu.text := '0';
  {包装}
  cComBaoz.text := '';
  {毛重}
  cEdtMaoz.text := '0';
  {体积}
  cEdttiji.text := '0';
  {计费重量}
  cEdtjfzl.text := '0';

  CedtRFileno.SetFocus;
end;

procedure TFrmAllImportBillEdit.BitBtn2Click(Sender: TObject);
var
  SearchCode: string;
begin
  inherited;
  try

    if FrmMain.IncludeValue('进口业务操作') then
    else
    begin
      ShowMessage('Sorry,You have no right to do it!');
      exit;
    end;

    if lvhw.Items.Count = 0 then
    begin
      ShowMessage('分单记录集为空,没有记录能够删除');
      exit;
    end;

    if LVhw.SelCount = 0 then
    begin
      ShowMessage('请选中一条要删除的记录');
      exit;
    end;

    if CisEDIT then
    else
    begin
      ShowMessage('分单记录正处于增加状态,不能够删除!');
      exit;
    end;

    if chkkeydown.Enabled then
    else
    begin
      ShowMessage('该进口所属于的主单已确认,您所具有的权限已操作不了该进口记录!');
      exit;
    end;

    if cchkkeydown.Enabled then
    else
    begin
      ShowMessage('该进口已确认,您所具有的权限已操作修改不了该进口记录!');
      exit;
    end;

    if Havefendan then {判断分单的费用记录中是否存在相应的从主单分摊过来的记录}
    begin
      ShowMessage(pchar('该分单费用中存在者主单分摊过来的费用' + chr(13) +
        '如果删除会造成主分单费用的不一致,请检查后再删除!'));
      exit;
    end;

    if MessageDlg('是否删除所选中的分单记录,' + chr(13) +
      '并将删除与该分单有关的所有记录,请确定', mtConfirmation, [mbYes, mbNo], 0) =
      mrYes then
    begin
      SearchCode := lvhw.Selected.Caption;
      {启动事务}
      if FrmMain.UseDB.InTransaction then
      else
        FrmMain.UseDB.BeginTrans;

      if FrmMain.ExecSQL('delete from fareinfo where filecode=''' + searchcode +
        '''') then
      else
      begin
        ShowMessage('与该分单相关联的费用数据删除有误,记录未删除,请检查!');
        FrmMain.UseDB.RollbackTrans;
        exit;
      end;

      if FrmMain.ExecSQL('delete from Planegoods where filecode=''' + searchcode
        + '''  ') then
      else
      begin
        ShowMessage('分单货物数据删除有误,记录未删除,请检查!');
        FrmMain.UseDB.RollbackTrans;
        exit;
      end;

      if FrmMain.ExecSQL('delete from Truckfile where trustcode=''' + searchcode
        + '''  ') then
      else
      begin
        ShowMessage('分单报关文件数据删除有误,记录未删除,请检查!');
        FrmMain.UseDB.RollbackTrans;
        exit;
      end;

      if FrmMain.ExecSQL('delete from landtrans where trustcode=''' + searchcode
        + '''  ') then
      else
      begin
        ShowMessage('分单进舱通知数据删除有误,记录未删除,请检查!');
        FrmMain.UseDB.RollbackTrans;
        exit;
      end;

      if FrmMain.ExecSQL('delete from PlanePredo where filecode=''' + searchcode
        + '''  ') then
      else
      begin
        ShowMessage('分单前期操作数据删除有误,记录未删除,请检查!');
        FrmMain.UseDB.RollbackTrans;
        exit;
      end;

      if FrmMain.ExecSQL('delete from requestinfo where filecode=''' + searchcode
        + '''') then
      else
      begin
        ShowMessage('与该分单相关联的运输数据删除有误,记录未删除,请检查!');
        FrmMain.UseDB.RollbackTrans;
        exit;
      end;
      if FrmMain.ExecSQL('delete from Planeorder where filecode=''' + searchcode
        + '''') then
      else
      begin
        ShowMessage('与该主单相关联的定舱数据删除有误,记录未删除,请检查!');
        FrmMain.UseDB.RollbackTrans;
        exit;
      end;

      if FrmMain.ExecSQL('delete from customerinfo where filecode=''' +
        searchcode + '''') then
      else
      begin
        ShowMessage('与该主单相关联的运输数据删除有误,记录未删除,请检查!');
        FrmMain.UseDB.RollbackTrans;
        exit;
      end;

      if FrmMain.ExecSQL('delete from custquote where filecode=''' + searchcode +
        '''') then
      else
      begin
        ShowMessage('与该主单相关联的运输数据删除有误,记录未删除,请检查!');
        FrmMain.UseDB.RollbackTrans;
        exit;
      end;

      if FrmMain.ExecSQL('delete from TrustState where filecode=''' + searchcode
        + '''') then
      else
      begin
        ShowMessage('与该主单相关联的货物跟踪数据删除有误,记录未删除,请检查!');
        FrmMain.UseDB.RollbackTrans;
        exit;
      end;

      if FrmMain.ExecSQL('delete from filetable where filecode=''' + searchcode +
        '''') then
      else
      begin
        ShowMessage('删除分单操作有误,记录未删除,请检查!');

⌨️ 快捷键说明

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