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

📄 inv_otherin_d.pas

📁 一个MRPII系统源代码版本
💻 PAS
📖 第 1 页 / 共 2 页
字号:
    exit;
  //数量
  floatcheck(sender);
  if  Vendortaxrate_Percent='' then
    Vendortaxrate_Percent:='0';  
  InvBillqty:=strtofloat(Extedt_InvBillqty.text);
  {  如果输入含税单价,则
     含税金额=四舍五入保留两位小数(数量*含税单价)
     不含税金额=含税金额/(1+税率/100)
     不含税单价=不含税金额/数量}
  //if ActiveControl=ExtEdt_InvBillqty then
  //  Exit;

  if InvBillqty=0.0 then
  begin
    DispInfo('数量不能为零!',1);
     Extedt_InvBillqty.setfocus;
    abort;
  end;

  {if oldPrice<>Extedt_Price.text then
  begin}
    //含税单价
    InvBillPrice:=strtofloat(Extedt_Price.text);
    //含税金额
    InvBillAmount:=InvBillPrice*InvBillqty;
    //不含税金额
    InvBillnotaxAmount:=InvBillAmount/(1+strtofloat(Vendortaxrate_Percent)/100.00);
    //不含税单价
    InvBillnotaxPrice:=InvBillnotaxAmount/InvBillqty;
    //所有带OLD这样的变量都是用于存放旧单价,旧金额,只要旧单价或旧金额与新单价或新金额有改变,则重新计算单价,金额
    Extedt_Amount.text:=formatfloat('#.00',InvBillAmount);
    Extedt_NotaxPrice.text:=floattostr(InvBillnotaxPrice);
    Extedt_NotaxAmount.text:=formatfloat('#.00',InvBillnotaxAmount);
    {oldPrice:=Extedt_Price.text;
    oldAmount:=formatfloat('#.00',InvBillAmount);
    oldnotaxPrice:=floattostr(InvBillnotaxPrice);
    oldnotaxAmount:=formatfloat('#.00',InvBillnotaxAmount);
  end;}
end;

procedure TFrm_Inv_OtherIn_D.Extedt_AmountExit(Sender: TObject);
var
  InvBillqty,InvBillPrice,InvBillAmount,InvBillnotaxPrice,InvBillnotaxAmount:real;
begin
  inherited;
   if ActiveControl.Name='btn_Cancel' then
    exit;
   floatcheck(sender);
  //数量
  if  Vendortaxrate_Percent='' then
    Vendortaxrate_Percent:='0';  
  InvBillqty:=strtofloat(Extedt_InvBillqty.text);
    //含税金额
     {  如果输入含税金额,则
     含税单价=含税金额/数量
     不含税金额=含税金额/(1+税率/100)
     不含税单价=不含税金额/数量}
  //if ActiveControl=ExtEdt_InvBillqty then
  //  Exit;

  if InvBillqty=0.0 then
  begin
    DispInfo('数量不能为零!',1);
    Extedt_InvBillqty.setfocus;
    abort;
  end;
  {if oldAmount<>Extedt_Amount.text then
  begin}
    InvBillAmount:=strtofloat(Extedt_Amount.text);
    //含税单价
    InvBillPrice:=InvBillAmount/InvBillqty;

    //不含税金额
    InvBillnotaxAmount:=InvBillAmount/(1+strtofloat(Vendortaxrate_Percent)/100.00);
    //不含税单价
    InvBillnotaxPrice:=InvBillnotaxAmount/InvBillqty;
    //所有带OLD这样的变量都是用于存放旧单价,旧金额,只要旧单价或旧金额与新单价或新金额有改变,则重新计算单价,金额
    Extedt_Price.text:=floattostr(InvBillPrice);
    Extedt_NotaxPrice.text:=floattostr(InvBillnotaxPrice);
    Extedt_NotaxAmount.text:=formatfloat('#.00',InvBillnotaxAmount);
    {oldAmount:=Extedt_Amount.text;
    oldPrice:=floattostr(InvBillPrice);
    oldnotaxPrice:=floattostr(InvBillnotaxPrice);
    oldnotaxAmount:=formatfloat('#.00',InvBillnotaxAmount);
  end;}
end;

procedure TFrm_Inv_OtherIn_D.Extedt_NotaxPriceExit(Sender: TObject);
var
  InvBillqty,InvBillPrice,InvBillAmount,InvBillnotaxPrice,InvBillnotaxAmount:real;
begin
  inherited;
   if ActiveControl.Name='btn_Cancel' then
    exit;
   floatcheck(sender);
  //数量
  if  Vendortaxrate_Percent='' then
    Vendortaxrate_Percent:='0';
  InvBillqty:=strtofloat(Extedt_InvBillqty.text);
  {   如果输入不含税单价,则
      不含税金额=四舍五入保留两位小数(数量*不含税单价)
      含税金额=不含税金额*(1+税率/100)
      含税单价=含税金额/数量}
  //不含税单价
  //if ActiveControl=ExtEdt_InvBillqty then
  //  Exit;

  if InvBillqty=0.0 then
  begin
    DispInfo('数量不能为零!',1);
    Extedt_InvBillqty.setfocus;
    abort;
  end;

  {if oldnotaxPrice<>Extedt_NotaxPrice.text then
  begin}
    InvBillnotaxPrice:=strtofloat(Extedt_NotaxPrice.text);
      //不含税金额
    InvBillnotaxAmount:=InvBillnotaxPrice*InvBillqty;
    //含税金额
    InvBillAmount:=InvBillnotaxAmount*(1+strtofloat(Vendortaxrate_Percent)/100.00);
    //含税单价
    InvBillPrice:=InvBillAmount/InvBillqty;
    //所有带OLD这样的变量都是用于存放旧单价,旧金额,只要旧单价或旧金额与新单价或新金额有改变,则重新计算单价,金额
    Extedt_Price.text:=floattostr(InvBillPrice);
    Extedt_Amount.text:=formatfloat('#.00',InvBillAmount);
    Extedt_NotaxAmount.text:=formatfloat('#.00',InvBillnotaxAmount);
    {oldnotaxPrice:=Extedt_NotaxPrice.text;
    oldPrice:=floattostr(InvBillPrice);
    oldAmount:=formatfloat('#.00',InvBillAmount);
    oldnotaxAmount:=formatfloat('#.00',InvBillnotaxAmount);
  end;}
end;

procedure TFrm_Inv_OtherIn_D.Extedt_NotaxAmountExit(Sender: TObject);
var
  InvBillqty,InvBillPrice,InvBillAmount,InvBillnotaxPrice,InvBillnotaxAmount:real;
begin
  inherited;
   if ActiveControl.Name='btn_Cancel' then
    exit;
   floatcheck(sender);
  //数量
  if  Vendortaxrate_Percent='' then
    Vendortaxrate_Percent:='0';
  InvBillqty:=strtofloat(Extedt_InvBillqty.text);
    {   如果输入不含税金额,则
        不含税单价=不含税金额/数量
        含税金额=不含税金额*(1+税率/100)
        含税单价=含税金额/数量}
  //if ActiveControl=ExtEdt_InvBillqty then
  //  Exit;

  if InvBillqty=0.0 then
  begin
    DispInfo('数量不能为零!',1);
    Extedt_InvBillqty.setfocus;
    abort;
  end;

  {if oldnotaxAmount<>Extedt_NotaxAmount.text then
  begin}
      //不含税金额
    InvBillnotaxAmount:=strtofloat(Extedt_NotaxAmount.text);
    //不含税单价
    InvBillnotaxPrice:=InvBillnotaxAmount/InvBillqty;

    //含税金额
    InvBillAmount:=InvBillnotaxAmount*(1+strtofloat(Vendortaxrate_Percent)/100.00);
    //含税单价
    InvBillPrice:=InvBillAmount/InvBillqty;
    //所有带OLD这样的变量都是用于存放旧单价,旧金额,只要旧单价或旧金额与新单价或新金额有改变,则重新计算单价,金额
    Extedt_Price.text:=floattostr(InvBillPrice);
    Extedt_Amount.text:=formatfloat('#.00',InvBillAmount);
    Extedt_NotaxPrice.text:=floattostr(InvBillnotaxPrice);
    {oldnotaxAmount:=Extedt_NotaxAmount.text;
    oldPrice:=floattostr(InvBillPrice);
    oldAmount:=formatfloat('#.00',InvBillAmount);
    oldnotaxPrice:=floattostr(InvBillnotaxPrice);
  end;}
end;

procedure TFrm_Inv_OtherIn_D.Extedt_NotaxPriceKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  inherited;
  if key=vk_F9 then
     Extedt_NotaxPrice.text:=GetOtherPrice(Extedt_ItemCode.text,'NoTaxPrice',AdoQry_tmp.Connection);
end;

procedure TFrm_Inv_OtherIn_D.Extedt_PriceKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  inherited;
  if key=vk_F9 then
     Extedt_Price.text:=GetOtherPrice(Extedt_ItemCode.text,'Price',AdoQry_tmp.Connection);
end;

procedure TFrm_Inv_OtherIn_D.Extedt_BatchnoExit(Sender: TObject);
var
  tmp_OutCode:string;
begin
  inherited;
  if ActiveControl.Name='btn_Cancel' then
    exit;
  if (not BatchCtrl(AdoQry_tmp,Extedt_ItemCode.text)) then
  begin
    if Trim(Extedt_Batchno.text)<>'' then
    begin
      DispInfo('该物料不受批次控制,不能录入批次号',1);
      twincontrol(sender).setfocus;
      abort;
    end
  end;


  if (BatchCtrl(AdoQry_tmp,Extedt_ItemCode.text)) then
  begin
    if (Extedt_Batchno.text='') then
    begin
      DispInfo('请录入批次号',1);
      twincontrol(sender).setfocus;
      abort;
    end
    else
    begin
      //如果是供应商,则把供应商代码传入BatchNOCHECK进行检验
      if outType='供应商' then
         tmp_OutCode:=outCode
      else
         tmp_OutCode:='';

      if not BatchNoCheck(AdoQry_tmp,Extedt_Batchno.text,Extedt_ItemCode.text,tmp_OutCode,fdate) then
      begin
        twincontrol(sender).setfocus;
        abort;
      end
      else
      begin
        if not BatchInvCheck(AdoQry_tmp,Extedt_Batchno.text,'R',fWhCode,fWhPositionCode,strtofloat(Extedt_InvBillqty.text)) then
        begin
          twincontrol(sender).setfocus;
          abort;
        end;
      end;
    end;
  end
end;

procedure TFrm_Inv_OtherIn_D.Extedt_BatchnoKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
var
  tmp_OutCode:string;
begin
  inherited;
  if (key=vk_F9) then
  begin
    if outType='供应商' then
       tmp_OutCode:=outCode
    else
       tmp_OutCode:='';
    Extedt_Batchno.text:=BatchHint(AdoQry_tmp.Connection,Extedt_ItemCode.text,tmp_OutCode,fwhCode,fWhPositionCode);
  end;
end;



procedure TFrm_Inv_OtherIn_D.Extedt_ItemCodeButtonClick(Sender: TObject);
begin
  inherited;
  if outType='供应商' then
    CommonHint(Sender,AdoQry_Tmp,'ItemName','物料名称','ItemCode',
    '物料代码','Item','ItemUsable=1 and ItemType in (0,2) and PmCode=1')
  else
    CommonHint(Sender,AdoQry_Tmp,'ItemName','物料名称','ItemCode',
    '物料代码','Item','ItemUsable=1 and ItemType in (0,2) ')
end;

procedure TFrm_Inv_OtherIn_D.btn_okClick(Sender: TObject);
begin
  Extedt_InvBillqty.onExit(Extedt_InvBillqty);
  Extedt_Price.onExit(Extedt_Price);
  Extedt_Amount.onExit(Extedt_Amount);
  Extedt_NotaxPrice.onExit(Extedt_NotaxPrice);
  Extedt_NotaxAmount.onExit(Extedt_NotaxAmount);
  if strtofloat(Extedt_InvBillqty.text)=0 then
  begin
    DispInfo('数量不能为零!',1);
    Extedt_InvBillqty.setfocus;
    abort;
  end;
  if strtofloat(Extedt_Price.text)=0 then
  begin
    DispInfo('含税价不能为零!',1);
    Extedt_Price.setfocus;
    abort;
  end;
  if strtofloat(Extedt_NotaxPrice.text)=0 then
  begin
    DispInfo('未税价不能为零!',1);
    Extedt_NotaxPrice.setfocus;
    abort;
  end;
  inherited;
end;

procedure TFrm_Inv_OtherIn_D.Extedt_ItemCodeKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  inherited;
 if(Key=120)then
 begin
   if outType='供应商' then
     CommonHint(Sender,AdoQry_Tmp,'ItemName','物料名称','ItemCode',
      '物料代码','Item','ItemUsable=1 and ItemType in (0,2) and PmCode=1')
    else
      CommonHint(Sender,AdoQry_Tmp,'ItemName','物料名称','ItemCode',
      '物料代码','Item','ItemUsable=1 and ItemType in (0,2) ')

 end;

end;

end.



⌨️ 快捷键说明

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