📄 inv_opadjustbill_b.pas
字号:
' where VendorCode='+
QuotedStr(ledt_Vendor.Text)+
' and ItemCode='+QuotedStr(fieldbyname('ItemCode').asstring);
AdoQry_tmp.ExecSQL;
lineno:=lineno+1;
next;
end;
end;
AdoQry_Body.Connection.CommitTrans;
//状态控制
//-----------
Billmemo:=edt_memo.text;
BillVendorCode:=ledt_Vendor.text;
BillLoginDate:=medt_Date.text;
edt_Billno.Text:=BillHeadno;
showflag:=True;
act_insertline.Enabled :=False;
act_Deleteline.Enabled :=False;
act_Save.Enabled :=False;
act_Modify.Enabled :=False;
AdoQry_Body.enableControls;
//---------
except
begin
AdoQry_Body.Connection.RollBackTrans;
AdoQry_Body.enableControls;
DispInfo(' 存盘不成功,请稍后再试! ',1);
abort;
end;
end;
inherited;
end;
procedure TFrm_Inv_OpAdjustBill_B.FormCreate(Sender: TObject);
begin
inherited;
Frm_Entry_Detail:=TFrm_Inv_OpAdjustBill_D.Create(Self);
end;
procedure TFrm_Inv_OpAdjustBill_B.InitControls;
var
Billid1:string;
begin
inherited;
edt_Billno.Enabled:=False;
AmountFields:='opBillnotaxAmount,';
if uppercase(Status)='AdD' then
begin
Edt_BillNo.Text:='';
MEdt_Date.Text:=FormatDateTime('yyyy.mm.dd',Now);
BillId1:='-1';
end
else
begin
if showflag then
begin
Billid1:=Billid;
end
else
begin
Billid1:=AdoQry_Head.fieldbyname('opBillid').asstring;
end;
Edt_BillNo.Text:=AdoQry_Head.fieldbyname('opBillno').asstring;
MEdt_Date.Text:=AdoQry_Head.fieldbyname('opBilldate').asstring;
end;
ledt_Vendor.Text:=AdoQry_Head.fieldbyname('VendorCode').asstring;
edit2.Text:=AdoQry_Head.fieldbyname('VendorName1').asstring;
Label7.Caption:=AdoQry_Head.fieldbyname('Vendortaxrate_Percent').asstring;
Label8.Caption:=AdoQry_Head.fieldbyname('currencyName').asstring;
with AdoQry_Body do
begin
Close;
sql.text:='select ol.opBillid,ol.opBilllineno,ol.ItemCode,'+
'Item.ItemName as ItemName,'+
'u.UomName,ol.opBillqty,ol.opBillnotaxAmount,ol.BilllineremArk '+
'from opAdjustBillline ol '+
'left join Item on Item.ItemCode=ol.ItemCode '+
'left join Uom u on u.UomCode=Item.UomCode '+
'where ol.opBillid='+Billid1;
open;
end;
end;
procedure TFrm_Inv_OpAdjustBill_B.ledt_VendorExit(Sender: TObject);
begin
inherited;
with AdoQry_tmp do
begin
Close;
sql.text:='select VendorName,Vendortaxrate_Percent,currency.currencyName from Vendor '+
' left join currency on currency.currencyCode=Vendor.currencyCode '+
' where VendorCode='+QuotedStr(ledt_Vendor.Text);
open;
if not eof then
begin
edit2.Text:=fieldbyname('VendorName').asstring;
label7.Caption:=fieldbyname('Vendortaxrate_Percent').asstring;
label8.Caption:=fieldbyname('currencyName').asstring;
end
else
begin
DispInfo('供应商不存在!',1);
ledt_Vendor.SetFocus;
end;
end;
end;
function TFrm_Inv_OpAdjustBill_B.GetNo1(AdoConnection:TAdoConnection;PreStr:String):string;
var
AdoQry_getno:TAdoQuery;
TmpPmParamCode,tMpstr,tmpwhCode,prestr2:String;
begin
AdoQry_getno:=TAdoQuery.Create(nil);
AdoQry_getno.EnableBCD:=False;
With AdoQry_GetNo do
begin
Connection:=AdoConnection;
Close;
sql.clear;
tMpstr:=copy(PreStr,Length(PreStr)-4,1);
tmpwhCode:=copy(PreStr,1,Length(PreStr)-5);
prestr2:=copy(PreStr,Length(PreStr)-4,5);
//委外材料结存调整单号
if UpperCase(tMpstr)='T' then
begin
Sql.text:=
'select max(substring(opBillno,6,5)) as maxBillno'
+' from opAdjustBill with(index(opBillno_index)) '
+' where substring(opBillno,1,5)='+quotedstr(PreStr2);
Open;
If fieldbyname('maxBillno').asstring='' then
Result:='00001'
else
Result:=Copy(IntToStr(100001+fieldbyname('maxBillno').Asinteger),2,5);
end;
Result:=PreStr+Result;
end;
AdoQry_getno.Free;
end;
procedure TFrm_Inv_OpAdjustBill_B.SaveHeadData;
begin
inherited;
with AdoQry_Head do
begin
if not(AdoQry_Head.State in [dsEdit,dsInsert])then
AdoQry_Head.edit;
fieldbyname('VendorCode').asstring:=ledt_Vendor.Text;
fieldbyname('VendorName1').asstring:=edit2.Text;
fieldbyname('Vendortaxrate_Percent').asstring:=Label7.Caption;
fieldbyname('currencyName').asstring:=Label8.Caption;
fieldbyname('EmployeeName').asstring:=userName;
fieldbyname('opBilldate').asstring:=medt_Date.text;
fieldbyname('opBillremArk').asstring:=edt_memo.Text;
fieldbyname('opBillno').AsString:=BillHeadno;
end;
end;
procedure TFrm_Inv_OpAdjustBill_B.Act_NewExecute(Sender: TObject);
begin
showflag:=False;
inherited;
end;
procedure TFrm_Inv_OpAdjustBill_B.FormShow(Sender: TObject);
begin
inherited;
with AdoQry_Tmp do
begin
Close;
sql.text:='select EmployeeName from Employee where EmployeeCode='+QuotedStr(UserCode);
open;
if not eof then
userName:=fieldbyname('EmployeeName').asstring;
end;
end;
procedure TFrm_Inv_OpAdjustBill_B.Act_PreviewExecute(Sender: TObject);
var
usertitle1,usertitle2,usertitle3:string;
begin
usertitle1:='单据号:'+edt_Billno.Text+' 单据日期:'+medt_Date.Text;
usertitle2:='供应商标识:'+ledt_Vendor.Text+' '+edit2.Text;
usertitle3:= '税率%:'+Label7.Caption+' 货币:'+
label8.Caption+' 备注:'+edt_memo.Text;
ExtPrintReport.Subtitle2:=usertitle1;
ExtPrintReport.Subtitle3:=usertitle2;
ExtPrintReport.Subtitle4:=usertitle3;
inherited;
end;
procedure TFrm_Inv_OpAdjustBill_B.Act_PrintExecute(Sender: TObject);
var
usertitle1,usertitle2,usertitle3:string;
begin
usertitle1:='单据号:'+edt_Billno.Text+' 单据日期:'+medt_Date.Text;
usertitle2:='供应商标识:'+ledt_Vendor.Text+' '+edit2.Text;
usertitle3:= '税率%:'+Label7.Caption+' 货币:'+
label8.Caption+' 备注:'+edt_memo.Text;
ExtPrintReport.Subtitle2:=usertitle1;
ExtPrintReport.Subtitle3:=usertitle2;
ExtPrintReport.Subtitle4:=usertitle3;
inherited;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -