📄 gl_enter_credencearh.pas
字号:
CredenceNo := PreStr+'0001';
end;
end;
4: begin
PreStr := userCode;
SqlText := ' Select Max(CredenceNo) As MaxOrderNo From Gl_Credence '
+' Where CredenceNo Like '''+PreStr+'''+''%''';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.Open;
if AdoQry_Tmp.fieldbyname('MaxOrderNo').AsString <> '' then
begin
CredenceNo := PreStr+copy(InttoStr(100000000+StrToInt(Copy(AdoQry_Tmp.fieldbyname('MaxOrderNo').AsString,Length(PreStr)+1,8))+1),2,8);
end
else
begin
CredenceNo := PreStr+'00000001';
end;
end;
5: begin
PreStr := 'J';
SqlText := ' Select Max(CredenceNo) As MaxOrderNo From Gl_Credence '
+' Where CredenceNo Like '''+PreStr+'''+''%''';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.Open;
if AdoQry_Tmp.fieldbyname('MaxOrderNo').AsString <> '' then
begin
CredenceNo := PreStr+copy(InttoStr(100000000+StrToInt(Copy(AdoQry_Tmp.fieldbyname('MaxOrderNo').AsString,Length(PreStr)+1,8))+1),2,8);
end
else
begin
CredenceNo := PreStr+'00000001';
end;
end;
end;
end;
procedure TFrm_Gl_Enter_CredenceArH.InitForm(AdOConnection: TAdOConnection;
ReadOnly: Boolean);
var SqlText : String;
begin
Application.ProcessMessages;
CreatePanel(1,dbgrideh);
inherited;
Flag := False;
DebitAmount := 0;
CreditAmount := 0;
SqlText := ' declAre @AccountYear int,'
+' @AccountMonth int '
+' select @AccountYear=IsNull(AccountPeriodYear,0), '
+' @AccountMonth=IsNull(AccountPeriodMonth,0) '
+' from Gl_AccountPeriod '
+' where CurrentPeriod=1 ';
If UpperCase(Param1)='Ar' then
begin
SqlText := SqlText +' declAre @SaleTaxKmCode varchAr(30) '
+' select @SaleTaxKmCode=ParamValueC from Gl_Param '
+' where ParamCode=''SaleTaxkmCode'' '
+' select Sa_SaleInvoice.InvoiceNo, '
+' Sa_SaleInvoice.InvoiceType, '
+' min(InvOutBill.BillTypeCode) as BillTypeCode, '
+' Sa_SaleInvoice.CustomerCode, '
+' Sa_SaleInvoice.CurrencyCode, '
+' Currency.CurrencyName, '
+' Sa_SaleInvoice.CurrencyCode+'' ''+Currency.CurrencyName as CurrencyFlag, '
+' Sa_SaleInvoice.ExchangeRate, '
+' Sa_SaleInvoice.TotalTaxAmount, '
+' Sa_SaleInvoice.TotalTaxAmountC, '
+' Sa_SaleInvoice.TotalTax, '
+' Sa_SaleInvoice.TotalTaxC, '
+' Customer.InvoiceArKmCode, '
+' Customer.GenerallyInvoiceArKmCode, '
+' Customer.SepcialInvoiceArKmCode, '
+' Sa_ExportTradeType.GenerallyInvoiceArKmCode as ExportTradeArKmCode '
+' Into #TMpSaleInvoice '
+' from Sa_SaleInvoice '
+' left join Customer on Sa_SaleInvoice.CustomerCode=Customer.CustomerCode '
+' left join Sa_ExportTradeType on Sa_SaleInvoice.ExportTradeTypeCode=Sa_ExportTradeType.ExportTradeTypeCode '
+' left Join Currency on Sa_SaleInvoice.CurrencyCode=Currency.CurrencyCode '
+' join Sa_SaleInvoiceLine on Sa_SaleInvoice.InvoiceNo=Sa_SaleInvoiceLine.InvoiceNo '
+' join InvOutBill on Sa_SaleInvoiceLine.InvBillId=InvOutBill.InvBillId '
+' where Sa_SaleInvoice.ISCredence=0 '
+' and InvoiceType1<>1 '
+' and DatePArt(yy,InAccountDate)=@AccountYear '
+' and DatePArt(mm,InAccountDate)=@AccountMonth '
+' group by Sa_SaleInvoice.InvoiceNo, '
+' Sa_SaleInvoice.InvoiceType, '
+' Sa_SaleInvoice.CustomerCode, '
+' Sa_SaleInvoice.CurrencyCode, '
+' Currency.CurrencyName, '
+' Sa_SaleInvoice.ExchangeRate, '
+' Sa_SaleInvoice.TotalTaxAmount, '
+' Sa_SaleInvoice.TotalTaxAmountC, '
+' Sa_SaleInvoice.TotalTax, '
+' Sa_SaleInvoice.TotalTaxC, '
+' Customer.InvoiceArKmCode, '
+' Customer.GenerallyInvoiceArKmCode, '
+' Customer.SepcialInvoiceArKmCode, '
+' Sa_ExportTradeType.GenerallyInvoiceArKmCode ';
SqlText := SqlText
+' select Ar_Gathering.GatheringNo, '
+' Ar_Gathering.CustomerCode, '
+' Ar_Gathering.CurrencyCode, '
+' Currency.CurrencyName, '
+' Ar_Gathering.CurrencyCode+'' ''+Currency.CurrencyName as CurrencyFlag, '
+' Ar_Gathering.ExchangeRate, '
+' BalanceType.GatheringKmCode, '
+' Customer.GenerallyInvoiceArKmCode, '
+' Customer.InvoiceArKmCode, '
+' Ar_Gathering.TotalTaxAmount, '
+' Ar_Gathering.TotalTaxAmountC '
+' into #TmpGathering '
+' from Ar_Gathering '
+' left join BalanceType on Ar_Gathering.BalanceTypeCode=BalanceType.BalanceTypeCode '
+' left join Currency on Ar_Gathering.CurrencyCode=Currency.CurrencyCode '
+' left join Customer on Ar_Gathering.CustomerCode=Customer.CustomerCode '
+' where ISCredence=0 '
+' and DatePArt(yy,InAccountDate)=@AccountYear '
+' and DatePArt(mm,InAccountDate)=@AccountMonth '
+' Create Table #TempCredence '
+' ( CredenceId Integer Identity ,'
+' CheckFlag Integer null default 0 , '
+' InvoiceNo varchAr(50) null, '
+' KmCode varchAr(30) null, '
+' CurrencyCode varchAr(10) null, '
+' CurrencyName varchAr(30) null, '
+' CurrencyFlag varchAr(50) Null, '
+' ExchRate Decimal(20,8) null, '
// +' KmName varchAr(100) Null,'
+' FDebitAmount decimal(20,2) null, '
+' FCreditAmount decimal(20,2) null, '
+' DebitAmount decimal(20,2) null, '
+' CreditAmount decimal(20,2) null, '
+' CredenceClass varchAr(20) null, '
+' CredenceType Integer null, '
+' Flag SmallInt null default 0 , '
+' RemArk varchAr(150) null ) ';
SqlText := SqlText
+' Insert Into #TempCredence(InvoiceNo,KmCode,CurrencyCode, CurrencyName, '
+' CurrencyFlag, ExchRate,'
+' FDebitAmount,FCreditAmount, '
+' DebitAmount,CreditAmount, '
+' CredenceClass,CredenceType, '
+' RemArk) '
+' '
+' /*******************************************************************************************/ '
+' '//一、销售发票: '
+' '
+' select InvoiceNo, '//发票号 '
+' InvoiceArKmCode as KmCode, '//应收帐款科目代码 '
+' CurrencyCode, '
+' CurrencyName, '
+' CurrencyFlag, '
+' ExchangeRate, '
{ +' Case when Sum(TotalTaxAmount)>0 then Sum(TotalTaxAmount) '
+' else 0 '
+' end as FDebitAmount,'//原币借方金额 '
+' Case when Sum(TotalTaxAmount)<0 then -Sum(TotalTaxAmount) '
+' else 0 '
+' end as FCreditAmount, '//原币贷方金额 '
+' case when Sum(TotalTaxAmountC)>0 then Sum(TotalTaxAmountC) '
+' else 0 '
+' end as DebitAmount,'//本位币借方金额 '
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -