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

📄 gl_enter_credencearh.pas

📁 一个MRPII系统源代码版本
💻 PAS
📖 第 1 页 / 共 5 页
字号:
            +'         NoInvoiceApKmCode as KmCode,  '//应付帐款科目代码                                        '
               +'          CurrencyCode, '
               +'          CurrencyName, '
               +'          CurrencyFlag, '
            +'         ExchRate,                                                                               '
{            +'         Case when Sum(InvBillQty*InvBillNoTaxPrice)>0 then Sum(InvBillQty*InvBillNoTaxPrice)    '
            +'              else 0                                                                             '
            +'         end as FDebitAmount,'//原币借方金额                                                      '
            +'         Case when Sum(InvBillQty*InvBillNoTaxPrice)<0 then -Sum(InvBillQty*InvBillNoTaxPrice)   '
            +'              else 0                                                                             '
            +'         end as FCreditAmount,         '//原币贷方金额                                            '
            +'         case when Sum(InvBillQty*InvBillNoTaxPriceC)>0 then Sum(InvBillQty*InvBillNoTaxPriceC)  '
            +'              else 0                                                                             '
            +'         end  as DebitAmount,'//本位币借方金额                                                    '
            +'         case when Sum(InvBillQty*InvBillNoTaxPriceC)<0 then -Sum(InvBillQty*InvBillNoTaxPrice)  '
            +'              else 0                                                                             '
            +'         end as CreditAmount,             '//本位币贷方金额                                       '
}
            +'         Sum(InvBillQty*InvBillNoTaxPrice) as FDebitAmount,'//原币借方金额                                                      '
            +'         0.0 as FCreditAmount,         '//原币贷方金额                                            '
            +'         Sum(InvBillQty*InvBillNoTaxPriceC)  as DebitAmount,'//本位币借方金额                                                    '
            +'         0.0 as CreditAmount,             '//本位币贷方金额                                       '

            +'         ''采购发票'','
            +'         1,'
            +'         ''供应商:''+VendorCode+'' 采购发票号:''+ApInvoiceNo as RemArk'//备注                         '
            +'   from  #TmpApInvoiceLine                                                                       '
            +'  where  InvBillNoTaxPrice>0                                                                     '
            +'  group by ApInvoiceNo,CurrencyCode,CurrencyName,CurrencyFlag,ExchRate,NoInvoiceApKmCode,VendorCode                                     '
            +'                                                                                                 '
            +'  union all                                                                                         '
            +'                                                                                                 '
            +'  select distinct ApInvoiceNo,  '//发票号                                                         '
            +'         InvoiceApKmCode as KmCode,  '//应付帐款科目代码                                          '
               +'          CurrencyCode, '
               +'          CurrencyName, '
               +'          CurrencyFlag, '
            +'         ExchRate,                                                                               '
{            +'         Case when ApInvoiceAmount<0 then -ApInvoiceAmount                                       '
            +'              else 0                                                                             '
            +'         end as FDebitAmount,'//原币借方金额                                                      '
            +'         Case when ApInvoiceAmount>0 then ApInvoiceAmount                                        '
            +'              else 0                                                                             '
            +'         end as FCreditAmount,         '//原币贷方金额                                            '
            +'         case when ApInvoiceAmountC<0 then -ApInvoiceAmountC                                     '
            +'              else 0                                                                             '
            +'         end  as DebitAmount,'//本位币借方金额                                                    '
            +'         case when ApInvoiceAmountC>0 then ApInvoiceAmountC                                      '
            +'              else 0                                                                             '
            +'         end as CreditAmount,             '//本位币贷方金额                                       '
}
            +'         0.0 as FDebitAmount,'//原币借方金额                                                      '
            +'         ApInvoiceAmount as FCreditAmount,         '//原币贷方金额                                            '
            +'         0.0  as DebitAmount,'//本位币借方金额                                                    '
            +'         ApInvoiceAmountC as CreditAmount,             '//本位币贷方金额                                       '

            +'         ''采购发票'','
            +'         1,'

            +'         ''供应商:''+VendorCode+'' 采购发票号:''+ApInvoiceNo as RemArk'//备注                         '
            +'   from  #TmpApInvoiceLine                                                                       '
            +'  where  ApInvoiceAmount>0                                                                       '
            +'                                                                                                 ';
    SqlText := SqlText
            +'  union all                                                                                         '
            +'  select distinct ApInvoiceNo,  '//发票号                                                         '
            +'         @PurchaseTaxKmCode as KmCode,  '//应付帐款科目代码                                       '
               +'          CurrencyCode, '
               +'          CurrencyName, '
               +'          CurrencyFlag, '
            +'         ExchRate,                                                                               '
{            +'         Case when ApInvoiceTax>0 then ApInvoiceTax                                              '
            +'              else 0                                                                             '
            +'         end as FDebitAmount,'//原币借方金额                                                      '
            +'         Case when ApInvoiceTax<0 then -ApInvoiceTax                                             '
            +'              else 0                                                                             '
            +'         end as FCreditAmount,         '//原币贷方金额                                            '
            +'         case when ApInvoiceTaxC>0 then ApInvoiceTaxC                                            '
            +'              else 0                                                                             '
            +'         end  as DebitAmount,'//本位币借方金额                                                    '
            +'         case when ApInvoiceTaxC<0 then -ApInvoiceTaxC                                           '
            +'              else 0                                                                             '
            +'         end as CreditAmount,             '//本位币贷方金额                                       '
}
            +'         ApInvoiceTax as FDebitAmount,'//原币借方金额                                                      '
            +'         0.0 as FCreditAmount,         '//原币贷方金额                                            '
            +'         ApInvoiceTaxC  as DebitAmount,'//本位币借方金额                                                    '
            +'         0.0 as CreditAmount,             '//本位币贷方金额                                       '

            +'         ''采购发票'','
            +'         1,'

            +'         ''供应商:''+VendorCode+'' 采购发票号:''+ApInvoiceNo as RemArk'//备注                         '
            +'   from  #TmpApInvoiceLine                                                                       '
            +'  where  ApInvoiceTax>0                                                                          '
            +'                                                                                                 '
            +'  union all                                                                                         '
            +'                                                                                                 '
            +'  select  ApInvoiceNo,  '//发票号                                                                 '
            +'         @ErrPurchaseRangeKmCode as KmCode,  '//应付帐款科目代码                                  '
               +'          CurrencyCode, '
               +'          CurrencyName, '
               +'          CurrencyFlag, '
            +'         ExchRate,                                                                               '
{            +'         Case when Sum(distinct ApInvoiceAmount)                                                 '
            +'                  -Sum(distinct ApInvoiceTax)                                                    '
            +'                  -Sum(InvBillQty*InvBillNoTaxPrice)>0                                           '
            +'             then Sum(distinct ApInvoiceAmount)                                                  '
            +'                  -Sum(distinct ApInvoiceTax)                                                    '
            +'                  -Sum(InvBillQty*InvBillNoTaxPrice)                                             '
            +'              else 0                                                                             '
            +'         end as FDebitAmount,'//原币借方金额                                                      '
            +'         Case when Sum(distinct ApInvoiceAmount)                                                 '
            +'                  -Sum(distinct ApInvoiceTax)                                                    '
            +'                  -Sum(InvBillQty*InvBillNoTaxPrice)<0                                           '
            +'              then -(Sum(distinct ApInvoiceAmount)                                               '
            +'                  -Sum(distinct ApInvoiceTax)                                                    '
            +'                  -Sum(InvBillQty*InvBillNoTaxPrice))                                            '
            +'              else 0                                                                             '
            +'         end as FCreditAmount,         '//原币贷方金额                                            '
            +'         case when Sum(distinct ApInvoiceAmountC)                                                '
            +'                  -Sum(distinct ApInvoiceTaxC)                                                   '
            +'                  -Sum(InvBillQty*InvBillNoTaxPriceC)>0                                          '
            +'              then Sum(distinct ApInvoiceAmountC)                                                '
            +'                  -Sum(distinct ApInvoiceTaxC)                                                   '
            +'                  -Sum(InvBillQty*InvBillNoTaxPriceC)                                            '
            +'              else 0                                                                             '
            +'         end  as DebitAmount,'//本位币借方金额                                                    '
            +'         case when Sum(distinct ApInvoiceAmountC)                                                '
            +'                  -Sum(distinct ApInvoiceTaxC)                                                   '
            +'                  -Sum(InvBillQty*InvBillNoTaxPriceC)<0                                          '
            +'              then -(Sum(distinct ApInvoiceAmountC)                                              '
            +'                  -Sum(distinct ApInvoiceTaxC)                                                   '
            +'                  -Sum(InvBillQty*InvBillNoTaxPriceC))                                           '
            +'              else 0                                                                             '
            +'         end as CreditAmount,             '//本位币贷方金额                                       '
}
            +'         Sum(distinct ApInvoiceAmount)                                                  '
            +'                  -Sum(distinct ApInvoiceTax)                                                    '
            +'                  -Sum(InvBillQty*InvBillNoTaxPrice)                                             '
            +'          as FDebitAmount,'//原币借方金额                                                      '
            +'         0.0 as FCreditAmount,         '//原币贷方金额                                            '
            +'         Sum(distinct ApInvoiceAmountC)                                                '
            +'                  -Sum(distinct ApInvoiceTaxC)                                                   '
            +'                  -Sum(InvBillQty*InvBillNoTaxPriceC)                                            '
            +'           as DebitAmount,'//本位币借方金额                                                    '
            +'         0.0 as CreditAmount,             '//本位币贷方金额                                       '

            +'         ''采购发票'','
            +'         1,'
            +'         ''供应商:''+VendorCode+'' 采购发票号:''+ApInvoiceNo as RemArk'//备注                         '
            +'   from  #TmpApInvoiceLine                                                                       '
            +'  where  ApInvoiceAmount>0                                                                       '
            +'  group by ApInvoiceNo,CurrencyCode,CurrencyName,CurrencyFlag,VendorCode,ExchRate                                                       '
            +'                                                                                                 '
            +'  /**********************************************************************************************/'
            +'  ';//三、采购付款:                                                                               '
    SQlText := SqlText
            +'  union  all                                                                                        '
            +'  select PayBillNo,                                                                              '
            +'         InvoiceApKmCode as KmCode, '//收款科目代码                                               '
               +'          CurrencyCode, '
               +'          CurrencyName, '
               +'          CurrencyFlag, '
            +'         ExchRate,                                                                               '
{            +'         Case when PayAmount>0 then PayAmount                                                    '
            +'              else 0                                                                             '
            +'         end as FDebitAmount, '//原币借方金额                                                     '
            +'         case when PayAmount<0 then -PayAmount                                                   '
            +'              else 0                                                                             '
            +'         

⌨️ 快捷键说明

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