tracylee
19th October 2017, 07:38
Hi, I have customize the invoices printing. I got 5 item on invoices but when print the report is show 6 item. For last record is same as previously record. If 1 item, then report printing will show 2 lines. So, how can i printing the data without duplicate last record? I try use lattr.break = true also cannot work. Please advise.

srprks
19th October 2017, 08:18
can you post your code

tracylee
19th October 2017, 09:44
can you post your code

Thanks for your reply. Sure.

I use detail.1 to display the items.

Below is my report script.


|******************************************************************************
|* Component : cisli120011000 VRC B60 a sy48 (FP6)
|* Name : Invoices
|* Author : Jan-Willem Sonderlo
|* Date Written : 29-12-2009 [16:45]
|******************************************************************************
|* Rev.No. 7 ciB60asy48 11 Mar 09 rhaitsma
|* Input field 'r.inventory.unit' changed into 'r.inv.unit.dsun'.
|* Input field 'r.order.unit' changed into 'r.order.unit.dsun'.
|* Input field 'r.price.unit' changed into 'r.price.unit.dsun'.
|* Rev.No. 8 ciB60asy48 11 Mar 09 rhaitsma
|* Input field 'r.item' is changed into 'r.inv.line.item'.
|* Rev.No. 9 ciB60asy48 25 May 09 rhaitsma
|* Porting of SL 236047. Solution 235838 makes it possible that the payment
|* method fields can be left empty on the payment schedule lines. If that is
|* done, then the payment method of the business partner must be used.
|* In case the payment method is entered on the sales invoice, then this method
|* should overrule the payment method array. But this should only be done in
|* case the payment method array is retrieved from the invoice-to BP.
|* (ERP-00000-54910)
|* Rev.No. 2 ciB60asy49 09 Jun 09 rhaitsma
|* 800-166993, charge type 'Service' has been added to domain cisli.chtp.
|* Rev.No. 3 ciB60asy49 12 Jun 09 wvdmolen
|* FP6-SBI, introduced detail 63 to print the SBI-correction amount on a
|* separate line
|* Rev.No. 4 ciB60asy49 24 Jun 09 apluijm
|* FP6-SBI, Arno Pluijm, 2009-06-24
|* Shipment Line added to report
|* Rev.No. 2 ciB60asy50 03 Jul 09 rhaitsma
|* r.ih.am.service was not taken into account when calculating r.goods.net.amnt.
|* Rev.No. 3 ciB60asy50 06 Jul 09 rhaitsma
|* Output argument added for external print functions (number of BR / Invoices
|* printed).
|* Rev.No. 4 ciB60asy50 22 Jul 09 rhaitsma
|* Draft printing must be handled via new printing DLL (cisli.dll9002 is
|* replaced by cisli.dll1200).
|* Rev.No. 5 ciB60asy50 24 Jul 09 rhaitsma
|* 800-169033, Tax summary was not printed for draft invoices (printing
|* initiated from external packages). Reason is that tables cisli206/9 were not
|* committed and therefore the content of these tables was not known in other
|* processes (like the invoice report) than the current process.
|* Rev.No. 2 ciB60asy51 25 Aug 09 rhaitsma
|* Porting of SL 239649. For service orders the location address must be printed
|* on the invoice instead of the ship-to address.
|* (ERP-00000-61390)
|* Rev.No. 3 ciB60asy51 27 Aug 09 rhaitsma
|* 800-169465, printing of item is handled via printing options of the invoicing
|* method.
|* Printing of Shipment Reference, Delivery Point and Packing Slip (External) is
|* done.
|* Rev.No. 4 ciB60asy51 27 Aug 09 rhaitsma
|* 800-169465, description of delivery point is also printed.
|* Rev.No. 5 ciB60asy51 31 Aug 09 rhaitsma
|* Field cisli255.sitx (Service Item Text) has been added.
|* Rev.No. 6 ciB60asy51 02 Sep 09 apluijm
|* 200-167043, Arno Pluijm, 2009-09-02
|* tcbano length 25->34, see http://www.ecbs.org/download/tr201/poland.pdf
|* for a description on domestic account number and IBAN numbers in Poland.
|* Rev.No. 2 ciB60asy52 10 Sep 09 rhaitsma
|* 800-169783, lay-out enhancements have been done on the invoice report.
|* Rev.No. 3 ciB60asy52 14 Sep 09 rhaitsma
|* 800-169881, The label 'Department' is now flexible. In case the department
|* is a sales office, then 'Sales Office' is shown, in case the department is a
|* service department, then 'Service Department' is shown, etc.
|* In case of multiple departments, the label remains 'Department'.
|* Rev.No. 4 ciB60asy52 15 Sep 09 rhaitsma
|* 800-169912, The second discount [Days] field is the same as the first
|* discount [Days] field. It should read r.top.disc.per2 instead.
|* Rev.No. 5 ciB60asy52 17 Sep 09 rhaitsma
|* VSC-warnings solved.
|* Rev.No. 6 ciB60asy52 18 Sep 09 rhaitsma
|* 800-170388, all amount fields are printed with format %A005 (like it is done
|* in the Sales Order Acknowledgement report).
|* Rev.No. 7 ciB60asy52 18 Sep 09 rhaitsma
|* 800-170395, tax summary is now printed in the details (once for every
|* invoice). Background: the tax summary content is imported. This is needed
|* because of draft printing (no commit, hence no table-content of cisli206/9
|* can be read in another process). For sales, project and some other origins,
|* the printing is done afterwards (the previous record is printed). In this
|* case the imported values contain data of the current record, where the
|* not-imported data contains data of the previous record.
|* Rev.No. 8 ciB60asy52 21 Sep 09 rhaitsma
|* 800-170395, calculation of tax summary amount in home currency was incorrect.
|* Rev.No. 2 ciB60asy53 23 Sep 09 rhaitsma
|* 800-170545, field cisli245.cuns (Delivered Quantity Unit) was not used.
|* Rev.No. 3 ciB60asy53 24 Sep 09 rhaitsma
|* More space reserved for 'Total (Rounded)' label.
|* Rev.No. 4 ciB60asy53 25 Sep 09 rhaitsma
|* 800-170429, a percentage sign is added if the discount percentage is
|* displayed.
|* Rev.No. 2 ciB60ast6 01 Oct 09 rhaitsma
|* 800-170874, the alternative item as present on the report represented the
|* alternative item code used by the customer. This concept is now replaced by
|* the storing of the customer item code in the CI tables.
|* Rev.No. 3 ciB60ast6 13 Oct 09 rhaitsma
|* 800-171180, the bank reference number was not printed.
|* Rev.No. 4 ciB60ast6 16 Oct 09 rhaitsma
|* 800-171180, if the country of the financial company differs from the country
|* of the invoice-to BP, then the bank reference is not applicable. The bank
|* reference field must be empty in that case.
|* Rev.No. 5 ciB60ast6 19 Oct 09 rhaitsma
|* Report fields have been synchronized with the external declarions of the
|* print DLL.
|* Rev.No. 6 ciB60ast6 28 Oct 09 rhaitsma
|* Label cisli.srvo (Service Order) is replaced by cisli.cost.type (Cost Type).
|* Rev.No. 7 ciB60ast6 28 Oct 09 rhaitsma
|* Fields re-arranged.
|* Rev.No. 8 ciB60ast6 28 Oct 09 rhaitsma
|* More space reserved for labels because of translation.
|* Rev.No. 9 ciB60ast6 04 Nov 09 rhaitsma
|* Variable 'r.suppr' must be handled for all detail lines.
|* Rev.No. 2 ciB60asy54 04 Dec 09 rhaitsma
|* Porting of SL243517, Fatal error when printing the payment schedule on an
|* invoice. Error: Use of NULL pointer on ''. This happens because function
|* 'initialize.invoice.line.data' is not always triggered.
|* (ERP-00000-70703)
|* Rev.No. 3 ciB60asy54 10 Feb 10 rhaitsma
|* FIN-083, payment schedules are also possible for credit notes.
|* Rev.No. 4 ciB60asy54 15 Feb 10 rhaitsma
|* Library cisli.dll0001 is removed from the library list.
|* Rev.No. 5 ciB60asy54 18 Feb 10 rhaitsma
|* Domain of billing request changed from cisli.brid (long(9)) into tcorno
|* (string(9)).
|* Rev.No. 7 ciB60asy54 11 Mar 10 fmargiot
|* TCS 800-172163: fmargiot 11/03/2010 Report changed to show discount amount
|* decimal
|* Rev.No. 8 ciB60asy54 02 Apr 10 fmargiot
|* fmargiot: The domain bpmdm.info (string 50) was replaced by tcmail (string
|* 100).
|* Rev.No. 9 ciB60asy54 22 Apr 10 eprovoos
|* Porting solution 245507 , Erik Provoost 2010-22-04
|* When an order discount is applicable for an order, this must be printed on
|* the invoice. But the amount printed is the amount of the last invoice line.
|* Infor365 216499
|* Rev.No. 10 ciB60asy54 07 May 10 fmargiot
|* Invoice printing anomaly regarding product variant
|* Infor365 270294
|* Rev.No. 11 ciB60asy54 07 May 10 fmargiot
|* Invoice printing anomaly regarding product variant
|* Infor365 270294
|* Rev.No. 13 ciB60asy54 07 May 10 fmargiot
|* Invoice printing anomaly regarding product variant
|* Infor365 270294
|* Rev.No. 14 ciB60asy54 27 May 10 fmargiot
|* SOL 247375, fmargiot 27-05-2010
|* Different ship to BP addresses not displayed
|* Infor365 273109
|* Rev.No. 15 ciB60asy54 28 May 10 eprovoos
|* Discount percentage of the previous line can be printed on an invoice line
|* without discount.
|* Infor365 275037
|* Rev.No. 16 ciB60asy54 22 Jun 10 fmargiot
|* SOL 248171, Filippo Margiotta, 2010-06-21
|* Material Serial NO from Maintenance Sales not printed in the invoice.
|* Infor365 274383
|* Rev.No. 17 ciB60asy54 25 Jun 10 fmargiot
|* SOL 248127, Filippo Margiotta, 2010-06-23
|* Installment number is not printed on the invoice.
|* Infor365 275715
|* Rev.No. 18 ciB60asy54 25 Jun 10 rhaitsma
|* 800-172954, labels for First Reference, Second Reference and Customer Order
|* have been added.
|* Rev.No. 2 ciB60asy56 27 Aug 10 rhaitsma
|* Porting of SL 249703. Currently both the delivery date and the delivery time
|* is part of the aggregation criteria for combining multiple sales order
|* invoice lines. This is too detailed. Only the delivery date part is relevant.
|* (Infor365: 284403)
|* Rev.No. 2 ciB60asy57 08 Sep 10 rhaitsma
|* PD49299, The concept of additional fields is added in cisli240 and in
|* cisli245.
|* Rev.No. 3 ciB60asy57 08 Sep 10 rhaitsma
|* PD49299, the 'Additional Information' fields are added as input fields to the
|* invoice report. There is no layout defined for these fields, because most
|* customers use a customized report.
|* Rev.No. 4 ciB60asy57 21 Sep 10 rhaitsma
|* PD49299, The concept of additional fields is added in cisli240 and in
|* cisli245.
|* Rev.No. 2 ciB60asy59 04 Dec 10 apluijm
|* temp checkin
|* Rev.No. 3 ciB60asy59 13 Dec 10 rhaitsma
|* 800-176216, the index of cisli247 is extended with 'Receipt' and 'Receipt
|* Line', because in theory (in case of direct delivery) an issue and a receipt
|* can result in an identical shipment/receipt number. Consequently duplicates
|* could arise. (Infor365: 286791)
|* Rev.No. 4 ciB60asy59 15 Dec 10 rhaitsma
|* 800-176183, option 'Print Item Text' is added in the BR Additions.
|* Rev.No. 2 ciB60asy61 09 Sep 11 rhaitsma
|* Pinting of tax code in tax summary must be done once for every tax code.
|* Rev.No. 3 ciB60asy61 13 Sep 11 rhaitsma
|* 800-179186, allignment of text in Workspace was incorrect. The report is
|* rendered mono-spaced (see SL 1006824).
|* Rev.No. 4 ciB60asy61 15 Sep 11 rhaitsma
|* Porting of SL 1001034, Updating cisli209.dsca with name of county, district,
|* state rather than repeating the enum description itself.
|* (Infor365: 303791)
|* Rev.No. 5 ciB60asy61 15 Sep 11 rhaitsma
|* 800-179186, alignment of Tax Text is changed from 'Right' to 'Not
|* Applicable'.
|* Rev.No. 6 ciB60asy61 21 Sep 11 rhaitsma
|* Filling of 'r.order.line.disc' is handled.
|* Rev.No. 7 ciB60asy61 05 Oct 11 rhaitsma
|* Porting of SL 1061448. Back-end changes for MSRS Reporting.
|* Rev.No. 8 ciB60asy61 05 Oct 11 rhaitsma
|* Porting of SL 1061448. Back-end changes for MSRS Reporting.
|* Rev.No. 9 ciB60asy61 03 Nov 11 rhaitsma
|* 800-179680, the data related to interest invoices as printed on the invoice
|* report is synchronized with the way it is displayed in the 'Interest Invoice
|* Data' session.
|* Rev.No. 10 ciB60asy61 04 Nov 11 rhaitsma
|* Sales Order Invoice Component Lines is extended with 'Route' and
|* 'Carrier/LSP'.
|*
|* Raju Kuripally ciB61Ma7 09 Nov 2011
|* When an invoice report is customized and the sort order is changed to
|* Ascending, the lot data is not printed correctly on the invoice.
|* Infor365 317647
|* Delivery Notes are not printed on invoice report.
|* Infor365 328365
|* Changes are marked with 1025761.
|* Rev.No. 11 ciB60asy61 18 Nov 11 rkuripal
|* Solution 1025761 has been ported.
|* When an invoice report is customized and the sort order is changed to
|* Ascending, the lot data is not printed correctly on the invoice.
|* Infor365 317647
|* Delivery Notes are not printed on invoice report.
|* Infor365 328365
|* Rev.No. 12 ciB60asy61 09 Dec 11 rkuripal
|* Solution for Defect 335391(Infor365) has been ported.
|* The Description of the 'Payment terms' is printing as Discount instead of
|* Payment Terms on the Invoice report.
|* In layout After.field r.copy.nr 41 , the label modified to 'Terms of
|* Payment'. The label 'Discount' is added on the left in the next layout:
|* After.field r.copy.nr 45
|* Rev.No. 13 ciB60asy61 15 Dec 11 pboorla
|* Porting SOL 1063890, Praveen Boorla
|* Defect: 331312
|* Shipment Information is missing in case of split delivery is done for a
|* sales order line. The quantity is getting accumulated to one shipment line.
|* Rev.No. 14 ciB60asy61 20 Dec 11 rhaitsma
|* FD51566, Archiving enhancements.
|* Rev.No. 15 ciB60asy61 23 Dec 11 rkuripal
|* DF-333144
|* Printing the Pay by BP bank account with branch details on the invoice
|* report.
|* Layout After.field r.copy.nr 65:
|* Domestic Bank id and International bank id and International Bank account
|* number has been added to the layout.
|* Rev.No. 16 ciB60asy61 23 Dec 11 rkuripal
|* Solution 1059289 ported.
|* When an invoice draft report is printed in the Contract Installment
|* session(tsctm4204m000), the item serial number is not printed on the invoice
|* report.
|* Infor365 328509
|* Report cisli120011000:
|* Added an input field to the report and inserted after the Item and
|* description field of Detail 9.
|* Rev.No. 17 ciB60asy61 16 Jan 12 rhaitsma
|* LND-3072, Domain of source type is changed from cisli.srct into cisli.srtp.
|* Rev.No. 18 ciB60asy61 23 Jan 12 rhaitsma
|* LND-3072, Add Contract and Contract Line to cisli230/5-cisli3xx.
|* Rev.No. 19 ciB60asy61 10 Feb 12 rhaitsma
|* Porting of SL 1125571, Error 205 out of range on cisli275.oref (Original
|* Order Reference) when system tries to add a high ascii sign in a field of
|* type string. (Infor365: 345422)
|* Rev.No. 20 ciB60asy61 02 Mar 12 rhaitsma
|* Invoice to BP name is printed on the invoice.
|* Rev.No. 21 ciB60asy61 14 Mar 12 rhaitsma
|* BINT error, variable 'r.activity' changed into 'r.ts.activity'.
|* Rev.No. 2 ciB60asy63 25 Apr 12 rhaitsma
|* 800-184626, Units are not correctly shown on the invoice.
|* Rev.No. 3 ciB60asy63 26 Apr 12 rhaitsma
|* Porting of SL 1042709, The invoiced quantity (= delivered quantity) is
|* printed in the delivery unit. This should be done in order line unit. (Like
|* in FP3). New variable is introduced so that in the report 3 delivered
|* quantities are available: in order line unit, in delivery unit and in
|* inventory unit. Standard report will print quantities in order line unit.
|* Customizations can be done to print in delivery unit.
|* (Infor365 321025)
|* Rev.No. 4 ciB60asy63 30 Apr 12 pboorla
|* Ported Solution: 1063221 Defect: 330862 (Infor365)
|* Discount details are not printed correctly on Invoice. In case of printing
|* of discount as 'Net' the other discount details like the discount percentage
|* etc should also be printed on the Invoice.
|* Rev.No. 5 ciB60asy63 01 May 12 pboorla
|* Porting Solution: 1129414 InforXtreme Defect: 347473
|* The customer order number for sales orders are taken from Sales Invoice
|* Headers(cisli240). But when the customer order number is present in lines
|* (cisli245) then that should be printed on the Invoice.
|* Rev.No. 2 ciB60asy65 04 Jul 12 rhaitsma
|* Introduction of Billable Lines (cisli810) table.
|* Rev.No. 2 ciB60asy66 31 Aug 12 rhaitsma
|* Table cisli247 is replaced by table cisli312.
|* Rev.No. 3 ciB60asy66 17 Sep 12 rhaitsma
|* Unused delivery notes variables are commented in the report script.
|* Rev.No. 2 ciB60asy67 04 Oct 12 rhaitsma
|* Cognos, argument 'r.no.of.pr.lines' is added so that the MS reporting service
|* can easily detect the last printed invoice line.
|* Rev.No. 3 ciB60asy67 04 Oct 12 rhaitsma
|* Porting of KB 1146030, Each shipment line is printed individually on the
|* invoice report, when a Sales Order line having multiple shipment lines is
|* processed from Central invoicing and that is printed from Central Invoicing.
|* (InforXtreme: 353928)
|* Rev.No. 4 ciB60asy67 10 Oct 12 rhaitsma
|* Integration TP-CI extended. The fields 'Area', 'Warehouse', 'Delivery Point',
|* 'Delivery Terms', 'Point of Title Passage', 'Carrier', 'Weight' and 'Weight
|* Unit' are passed from the contract to Invoicing.
|* Rev.No. 5 ciB60asy67 24 Oct 12 rmahesh
|* Detail 15 0 Condition based on source type replacd by condition based labour
|* type filled yes/no.
|* Rev.No. 2 ciB60asy72 31 Dec 12 rmahesh
|* Added r.goods.gross.am as report input fields. Not used in the layout.
|* Rev.No. 3 ciB60asy72 23 Jan 13 rhaitsma
|* Porting of KB 1371107. The customer order line and customer order sequence
|* are missing when
|* printing an invoice in the MS format.
|* (InforXtreme: 387045)
|* Rev.No. 4 ciB60asy72 06 Feb 13 rmahesh
|* original Invoice specification in the invoice report. for credit notes.
|* Rev.No. 5 ciB60asy72 11 Feb 13 rmahesh
|* Print Original Invoice related changes.
|* Rev.No. 6 ciB60asy72 11 Feb 13 rhaitsma
|* KB 1375252, the delivery terms code is not printed on the invoice.
|* (InforXtreme: 389168)
|* Rev.No. 2 ciB60asy74 07 May 13 rmahesh
|* 800-190694 - Your ID - Invoice to bp name not printed.
|* Rev.No. 3 ciB60asy74 16 May 13 rmahesh
|* 800-191132 - Component lines not selected correctly resulting in fatal error
|* when allocating memory.
|* Rev.No. 4 ciB60asy74 16 May 13 rmahesh
|* .
|* Rev.No. 2 ciB60asy76 05 Jul 13 bpape
|* With aggragation level 'Activity' or 'Activity/Cost type' the quantity, unit
|* and price should not be shown on the invoice and the serial number should be
|* added.
|* DF 400629, KB 1398488
|* Rev.No. 2 ciB60asy77 11 Jul 13 rhaitsma
|* 800-192539, the price must not be shown for Customer Claim and Supplier
|* Claim.
|* Rev.No. 3 ciB60asy77 17 Jul 13 rhaitsma
|* Label changes in 'Tax' group box.
|* Rev.No. 4 ciB60asy77 15 Aug 13 rhaitsma
|* 800-192805, Too much space reserved for the cost object.
|* Rev.No. 5 ciB60asy77 23 Sep 13 eprovoos
|* Porting SOL 1432259, Erik Provoost, 2013-09-11
|* Although it is possible to aggregate on cost component, the cost component
|* itself is not printed on the invoice.
|* InforXtreme 417266
|* Rev.No. 6 ciB60asy77 30 Sep 13 rhaitsma
|* Aggregate Tax implementation
|* Porting SOL 1451250, Erik Provoost, 2013-11-18
|* Configuration lines are not printed on the invoice (as was done in earlier
|* FP's).
|* InforXtreme 426629
|* Rev.No. 7 ciB60asy77 18 Nov 13 eprovoos
|* Porting SOL 1451250, Erik Provoost, 2013-11-18
|* Configuration lines are not printed on the invoice (as was done in earlier
|* FP's).
|* InforXtreme 426629
|* Rev.No. 8 ciB60asy77 22 Nov 13 eprovoos
|* Porting KB 1419676 Erik Provoost 2013-11-22
|* Since MS reporting can not handle layout.again(), serial number fields are
|* not available in SSRS for Invoice. New tools function should provide this
|* option.
|* InforXtreme 410846
|* Rev.No. 9 ciB60asy77 27 Nov 13 rmahesh
|* Progress Payment request.
|* Rev.No. 10 ciB60asy77 04 Feb 14 eprovoos
|* SOL 1472358, Erik Provoost, 2014-01-31
|* Incomplete fix 1039380. Default terms of payment is determined from
|* Schedules or invoice line, and lastly from BP. But after that it is
|* overwritten again.
|* Internal remark.
|* Rev.No. 11 ciB60asy77 18 Feb 14 bpape
|* Texts starting with < are for internal use only and should not be printed on
|* external reports. This is currently not done for item text.
|* DF 435488; KB 1468471
|* Rev.No. 12 ciB60asy77 17 Mar 14 bpape
|* Add Material Pricing information to the invoice report.
|* PD#52351, marked with lnd-8235
|* Rev.No. 13 ciB60asy77 19 Mar 14 bpape
|* Rectify domain usage. r.order.line is tcsli.orln
|* Rev.No. 14 ciB60asy77 06 May 14 eprovoos
|* Line discounts smaller than 1.00 are not printed on the invoice line.
|* lval() is used in the print condition and this truncates the argument.
|* Rev.No. 2 ciB60asy79 05 Jun 14 rhaitsma
|* 800-196679, domain bpmdm.telp -->tctelp.
|* Rev.No. 4 ciB60asy79 06 Jun 14 rmahesh
|* Enable tax handling in different currency than the net invoice currency by
|* creating separate net and tax invoices. See cd# 52961.
|* Rev.No. 5 ciB60asy79 20 Jun 14 fvantoly
|* 800-196848 'Rebate Agreement Text' should be renamed into 'Invoice Text'
|* throughout invoicing
|*
|* SOL 1504265
|* Because the discount percentage is stored in a string ending in " %", the
|* val() function in print condition cannot handle this and no percentage is
|* printed. Val() is moved to report script.
|* InforXtreme 454361
|* Rev.No. 6 ciB60asy79 24 Jun 14 eprovoos
|* Porting SOL 1504265, Erik Provoost, 2014-06-06
|* Because the discount percentage is stored in a string ending in " %", the
|* val() function cannot handle this and no percentage is printed
|* InforXtreme 454361
|* Rev.No. 7 ciB60asy79 26 Jun 14 fvantoly
|* SOL 1506962, Robert Haitsma, 2014-06-04 The invoice-to contact and the
|* business entity identifier are not available on the invoice report. (No
|* InforXtreme defect available).
|* Rev.No. 2 ciB60asy81 29 Jul 14 rhaitsma
|* 800-197620, For the reference activity based pricing topic 3 new fields must
|* be added to the billable line and printed on the invoice: Reference Activity,
|* Master Routing and Routing Option.
|* Rev.No. 3 ciB60asy81 30 Jul 14 bpape
|* Add r.ih.fees.penalty to the report
|* Rev.No. 4 ciB60asy81 01 Aug 14 rhaitsma
|* Porting of KB 1502299, In case part of the invoice lines are exempt from tax,
|* the taxable amount as shown in the tax summary is not correct. It shows the
|* complete invoice amount and not the amount for which the tax applies.
|* (InforXtreme: 453343)
|* Rev.No. 3 ciB60asy82 02 Sep 14 bpape
|* BP-suramnt: Add r.mpr.surch.amnt and r.mpr.tot.surch to the report input
|* fields (not yet available in the integration)
|* Rev.No. 2 ciB6111sy01 16 Dec 14 rhaitsma
|* Title is derived from the contact of the invoice-to BP. If not present then
|* the title of the invoice-to BP is used.
|* Rev.No. 3 ciB6111sy01 17 Dec 14 bpape
|* Conversion: cisli.srtp -> tcsli.srtp
|* Rev.No. 4 ciB6111sy01 17 Dec 14 bpape
|* citcslisrtp: Replace cisli.srtp with the identical tcsli.srtp
|* Rev.No. 5 ciB6111sy01 19 Dec 14 bpape
|* citcslisrtp: Replace cisli.ortp with tcsli.srtp
|* Rev.No. 6 ciB6111sy01 29 Dec 14 bpape
|* When printing to MS SSRS, only the first due date is present (r.due.date),
|* but all other payment terms are not, due to these being arrays. New input
|* fields should be set and rpi.write.additional.row should be used.
|* DF 481328; KB 1583946
|* Rev.No. 7 ciB6111sy01 28 Jan 15 rhaitsma
|* LND2-2486, Domain of cisli505.pksp changed from tcmcs.st30m into tcpksp.
|* Domain of cisli505.pksl changed from tcmcs.st30m into tcpksl.
|* Rev.No. 2 ciB6112sy01 08 May 15 eprovoos
|* Porting KB 1444682, German requirement for "Korrekturrechnung".
|* InforXtreme 495634
|* Rev.No. 3 ciB6112sy01 08 May 15 fvantoly
|* LND2-2061 Terminology Change billing.request -> invoicing.batch
|* Rev.No. 4 ciB6112sy01 11 May 15 fvantoly
|* LND2-2061 terminology change for reports
|* Rev.No. 5 ciB6112sy01 01 Jun 15 inforln
|* TIV number of component set to 2020
|* Rev.No. 2 ciB6113sy01 12 Jun 15 rhaitsma
|* LND2-5420, Intercompany Trade. Remove obsolete source types.
|* Rev.No. 2 ciB6116sy01 04 Mar 16 fvantoly
|* Installment Invoicing - Prorate installments.CD #54407.
|* Rev.No. 3 ciB6116sy01 24 Mar 16 hbohemen
|* lnd2-5078: Logistic fields reference to logistic/operational tables.
|* Rev.No. 4 ciB6116sy01 24 Mar 16 hbohemen
|* fp16-debug
|* Rev.No. 5 ciB6116sy01 30 Mar 16 rhaitsma
|* LND2-5158, removed direct use of tcmcs.dll0036.
|* Rev.No. 6 ciB6116sy01 31 Mar 16 rhaitsma
|* LND2-10517, removal of tp-specific domains.
|* Rev.No. 7 ciB6116sy01 13 May 16 hbohemen
|* lnd2-5078: Logistic fields reference to logistic/operational tables.
|******************************************************************************
declaration:
#ident "@(#)cisli120011000 ciB6116sy01 NLBAWAPPSDEV1 Rev.No. 7 13 May 16 hbohemen"
#ident "@(#)cisli120011000 ciB6113sy01 NLBAWAPPSDEV1 Rev.No. 2 12 Jun 15 rhaitsma"
#ident "@(#)cisli120011000 ciB6112sy01 NLBAWAPPSDEV1 Rev.No. 4 11 May 15 fvantoly"
#ident "@(#)cisli120011000 ciB6111sy01 NLBAWAPPSDEV1 Rev.No. 7 28 Jan 15 rhaitsma"
#ident "@(#)cisli120011000 ciB60asy82 NLBAWAPPSDEV1 Rev.No. 3 02 Sep 14 bpape"
#ident "@(#)cisli120011000 ciB60asy81 NLBAWAPPSDEV1 Rev.No. 4 01 Aug 14 rhaitsma"
#ident "@(#)cisli120011000 ciB60asy79 NLBAWAPPSDEV1 Rev.No. 7 26 Jun 14 fvantoly"
#ident "@(#)cisli120011000 ciB60asy77 nlbaudv3 Rev.No. 13 19 Mar 14 bpape"
#ident "@(#)cisli120011000 ciB60asy76 nlbaudv3 Rev.No. 2 05 Jul 13 bpape"
#ident "@(#)cisli120011000 ciB60asy74 nlbaudv3 Rev.No. 4 16 May 13 rmahesh"
#ident "@(#)cisli120011000 ciB60asy72 nlbaudv3 Rev.No. 6 11 Feb 13 rhaitsma"
#ident "@(#)cisli120011000 ciB60asy67 nlbaudv3 Rev.No. 4 10 Oct 12 rhaitsma"
#ident "@(#)cisli120011000 ciB60asy66 nlbaudv3 Rev.No. 3 17 Sep 12 rhaitsma"
#ident "@(#)cisli120011000 ciB60asy65 nlbaudv3 Rev.No. 2 04 Jul 12 rhaitsma"
#ident "@(#)cisli120011000 ciB60asy63 nlbaudv3 Rev.No. 3 26 Apr 12 rhaitsma"
#ident "@(#)cisli120011000 ciB60asy61 nlbaudv3 Rev.No. 21 14 Mar 12 rhaitsma"
#ident "@(#)cisli120011000 ciB60asy61 nlbaudv1 Rev.No. 10 04 Nov 11 rhaitsma"
#ident "@(#)cisli120011000 ciB60asy59 nlbaudv1 Rev.No. 4 15 Dec 10 rhaitsma"
#ident "@(#)cisli120011000 ciB60asy57 nlbaudv1 Rev.No. 4 21 Sep 10 rhaitsma"
#ident "@(#)cisli120011000 ciB60asy54 nlbaudv1 Rev.No. 5 18 Feb 10 rhaitsma"
#ident "@(#)cisli120011000 ciB60ast6 nlbaudv1 Rev.No. 5 19 Oct 09 rhaitsma"
#ident "@(#)cisli120011000 ciB60asy53 nlbaudv1 Rev.No. 2 23 Sep 09 rhaitsma"
#ident "@(#)cisli120011000 ciB60asy52 nlbaudv1 Rev.No. 5 17 Sep 09 rhaitsma"
#ident "@(#)cisli120011000 ciB60asy51 nlbaudv1 Rev.No. 5 31 Aug 09 rhaitsma"
#ident "@(#)cisli120011000 ciB60asy50 nlbaudv1 Rev.No. 4 22 Jul 09 rhaitsma"
#ident "@(#)cisli120011000 ciB60asy49 nlbaudv1 Rev.No. 2 09 Jun 09 rhaitsma"
#ident "@(#)cisli120011000 ciB60asy48 nlbaudv1 Rev.No. 9 25 May 09 rhaitsma"

#include <bic_text>
#include "itccom0000" |* Multicurrency variables and handling
#include "itcmcs0012"

#define monospace |#800-179186.n
#define MAX.NO.DISCOUNTS 11


table tcisli305 | Invoice Header
table tcisli310 | Invoice Lines
table ttcibd001 | Items
table ttdsls400 | Sales Orders
table ttccom140 | Contacts
table ttccom130 | Addresses
table ttcmcs002 | Currencies

domain tcmcs.long ii
domain tcmcs.long len.paym
domain tcmcs.long no.disc.lines
domain tcmcs.long remaining.empty.header.lines
extern domain tcmcs.long r.disc.element

boolean repeat.layout
boolean get.payment.schedule
domain tctax.rndg tax.rounding.method

domain tcmcs.str12 discount.format
domain tcmcs.str12 amount.format

domain tclang dummy.language
domain tcmcs.long dummy.long
string dummy.string(1)
domain tcmcs.s300m dummy.error.message

|* General
extern domain tcmcs.st35 r.doc.type.string
extern boolean r.end.invoice
|* extern domain tcmcs.str12 r.discount |* old TCS 800-172163
extern domain tcmcs.str14 r.discount |* new TCS 800-172163
| extern domain tcamnt r.goods.net.amnt |#1061448.o
extern domain tcamnt r.transport.amount
extern domain tctax.rndg r.tax.rounding.method
extern domain tcgld.date invoice.date
extern domain tcbool r.print.discount.value |#1504265.n
extern domain tcbool r.print.discount |#1398488.sn
extern domain tcbool r.aggregated.line
extern domain tcpono r.activity |#1398488.en
extern domain tcbool r.hide.price |#800-192539.n

|* Lots and Serials
domain tcmcs.long lot.serial.element
| extern domain tcmcs.str100 r.lot.serial.string |#1419676.o
extern domain tcmcs.str100 r.lots.serials(1) based
extern domain tcqiv1 r.lot.qty(1) based
|#1419676.so
| extern domain tcmcs.long r.no.lots.serials |#1025761.n
|#1419676.eo
|* Tax Summary
| boolean tax.by.tax.authority
| boolean tax.by.tax.code
| domain tcmcs.long sql.id.tax.authority
| domain tcmcs.long sql.id.tax.code
extern domain tcmcs.ctau r.tax.authority
extern domain tcdsca r.tax.authority.desc
extern domain tcyesno r.tax.line.exempt |#1502299.n
extern domain tcfovn r.tax.authority.exempt
extern domain tcamnt r.tax.authority.base.am
extern domain tcpvat r.tax.authority.percent
extern domain tcamnt r.tax.authority.am
extern domain tcamnt r.tax.authority.am.hc
extern domain tcmcs.str10 r.jurisdiction.level |#1001034.n
| extern domain tcamnt r.tax.authority.am.hc(MAX.CURRENCIES)
boolean g.tax.summary
boolean g.tax.code.present
boolean g.tax.authority.present
domain tctxtn g.tax.text
long g.current.tax.authority.record
long g.current.tax.code.record
| domain tcccty g.current.tax.country
| domain tccvat g.current.tax.code
domain tcmcs.long g.no.of.records
domain tcmcs.long g.no.of.tax.codes
domain tcmcs.long g.no.of.home.currencies
domain tcmcs.long i
extern domain tcmcs.ctau r.ts.tax.authority(1) based
extern domain tcdsca r.ts.tax.authority.desc(1) based
|#1502299.sn
extern domain tcyesno r.ts.tax.line.exempt(1) based
|#1502299.en
extern domain tcfovn r.ts.tax.authority.exempt(1) based
extern domain tcamnt r.ts.tax.authority.base.am(1) based
extern domain tcpvat r.ts.tax.authority.percent(1) based
extern domain tcamnt r.ts.tax.authority.am(1) based
extern domain tcamnt r.ts.tax.authority.am.hc(1, 1) based
|#1001034.sn
extern domain tcmcs.str10 r.ts.juris.level(1) based
|#1001034.en
extern domain tcccty r.ts.tax.country.array(1) based
extern domain tccvat r.ts.tax.code.array(1) based
|#1869187.sn
extern domain tctxtn r.ts.tax.text.array(1) based
|#1869187.en
|#aggr_tax.sn
extern domain tccvat r.ts.line.tax.code.array(1) based
|#aggr_tax.en

|* Payment Schedules
domain tcmcs.long no.paym.sched.lines
domain tcgld.date paym.sched.due.date.local.arr(1) based
| extern domain tcmcs.long r.paym.sched.element |#1583946.so
| extern domain tcamnt r.paym.sched.tot.amount
| extern domain tcccur r.paym.sched.euro |#1583946.eo
extern domain tcmcs.long r.ps.element |#1583946.sn
extern domain tcamnt r.ps.total.amount
extern domain tcccur r.ps.euro |#1583946.en
extern domain tcamnt r.paym.sched.amount.arr(1) based
extern domain tcamnt r.paym.sched.amount.eur.arr(1) based
extern domain tcpaym r.paym.sched.payment.method.arr(1) based
extern domain tcdate r.paym.sched.due.date.arr(1) based
|* Variables specific for MS SSRS |#1583946.sn
extern domain tcbool r.ps.line
extern domain tcdate r.ps.due.date
extern domain tcamnt r.ps.amount
extern domain tcamnt r.ps.amount.eur
extern domain tcpaym r.ps.paym.method |#1583946.en

| |* Delivery Notes
| domain tcmcs.long length.delivery.notes
| domain tcmcs.long pos.of.next.delivery.note
| domain tcmcs.str300m delivery.notes

|* Service Contract Configurations
boolean dummy.bool |#1451250.sn
domain tcmcs.long configurations.counter |#1451250.en

|* Kitting Components
static boolean g.arrays.filled
domain tcmcs.long g.actual.component.line
domain tcmcs.long g.max.no.of.components
domain tcshpm g.component.shipment(1) based
domain tcpono g.component.shipment.line(1) based
|#800-176216.sn
domain tcshpm g.component.receipt(1) based
domain tcpono g.component.receipt.line(1) based
|#800-176216.en
domain tcncmp g.logistic.company(1) based
|#1869550.sn
domain cisli.seqn g.dummy.sequence(1) based
|#1869550.en
domain tcitem g.component(1) based
domain tcqiv1 g.delivered.qty.inv.unit(1) based
domain tcqsl1 g.delivered.qty.order.unit(1) based
domain tccuni g.order.unit(1) based
domain tcconv g.conversion.factor(1) based
domain tcdate g.delivery.date(1) based
domain tccdec g.terms.of.delivery(1) based
domain tcptpa g.point.of.title.passage(1) based
domain tcguid g.lot.and.serial.set(1) based
domain tccrte g.route(1) based
domain tccfrw g.carrier.lsp(1) based
domain tctxtn g.component.text(1) based
domain tctxtn g.item.text(1) based
extern domain tcitem r.component.item
extern domain tcdsca r.component.item.dsca
extern domain tcqsl1 r.component.ordered.qty
extern domain tcqiv1 r.component.ordered.qty.inv
extern domain tcqsl1 r.component.delivered.qty
extern domain tcqiv1 r.component.delivered.qty.inv
extern domain tccuni r.component.sales.unit
extern domain tccuni r.component.inventory.unit
extern domain tcmcs.s100m r.component.terms.of.delivery.dsca
extern domain tcshpm r.component.shipment
extern domain tcpono r.component.shipment.line
extern domain tcshpm r.component.receipt |#800-176216.n
extern domain tcpono r.component.receipt.line|#800-176216.n
extern domain tcdate r.component.delivery.date
extern domain tccrte r.component.route
extern domain tcdsca r.component.route.dsca
extern domain tccfrw r.component.carrier.lsp
extern domain tcdsca r.component.carrier.lsp.dsca
extern domain tcmcs.str30 r.component.text.label
extern domain tcmcs.str30 r.item.text.label

|* Material Pricing lines |#lnd-8235.sn
domain tcmcs.long mpr.current.line
extern domain tcmcs.long r.mpr.num.lines
extern domain tcbool r.mpr.is.detail
extern domain tcpono r.mpr.line.arr(1) based
extern domain tcmpr.matr r.mpr.material.arr(1) based
extern domain tcdsca r.mpr.material.description.arr(1) based
extern domain tcqrd3 r.mpr.content.quantity.arr(1) based
extern domain tccuni r.mpr.material.unit.arr(1) based
extern domain tcqrd3 r.mpr.quantity.factor.arr(1) based
extern domain tcmcs.fact r.mpr.billable.quantity.factor.arr(1) based
extern domain tcpric r.mpr.base.price.arr(1) based
extern domain tccuni r.mpr.price.unit.arr(1) based
extern domain tcpric r.mpr.tot.base.price.arr(1) based
extern domain tcpric r.mpr.actual.price.arr(1) based
extern domain tcpric r.mpr.tot.actual.price.arr(1) based
extern domain tcyesno r.mpr.manual.actual.price.arr(1) based
extern domain tcyesno r.mpr.manual.arr(1) based
extern domain tctxtn r.mpr.text.arr(1) based
|#BP-suramnt.sn
extern domain tcamnt r.mpr.surch.amnt.arr(1) based
|#BP-suramnt.en

extern domain tcpono r.mpr.line
extern domain tcmpr.matr r.mpr.material
extern domain tcdsca r.mpr.mat.desc
extern domain tcqrd3 r.mpr.cont.quan
extern domain tccuni r.mpr.mat.unit
extern domain tcqrd3 r.mpr.quan.fact
extern domain tcmcs.fact r.mpr.bill.fact
extern domain tcpric r.mpr.base.price
extern domain tccuni r.mpr.price.unit
extern domain tcpric r.mpr.tot.base
extern domain tcpric r.mpr.actual.pric
extern domain tcpric r.mpr.tot.actual
extern domain tcyesno r.mpr.man.actual
extern domain tcyesno r.mpr.manual
extern domain tctxtn r.mpr.line.text |#lnd-8235.en
extern domain tcamnt r.mpr.surch.amnt |#BP-suramnt.n

extern domain tcmcs.str30 r.210.irdt.label |#800-179680.n
extern domain tcmcs.str30 r.210.irai.label |#800-179680.n

extern domain tcmcs.str15 ship_to
extern domain tcwght weight, total.wght, s.total.wght
extern domain tcmcs.str30 del.tel, del.fax, del.attn, del.name, tel, fax, attn
extern domain tcqiv1 s.total.qty, total.qty
extern domain tcamnt total.amount
extern domain tcmcs.str132 amnt.word2, noted.bottom.1, noted.bottom.2, noted.bottom.3, noted.bottom.4, noted.bottom.5, noted.bottom.6


string amt.txt(11), chr.sgl(1), word.sgl(10)
string chr.ten(1), word.ten(10), amt.inword(132)
string word.A(10), word.B(10), word.c(10), word.D(10), word.E(10)
string word.F(10), word.G(10), word.H(10), Word.I(10), word.J(10)
string str.A(1), str.B(1), str.c(1), str.D(1), str.E(1)
string str.F(1), str.G(1), str.H(1), str.I(1), str.J(1)
string unit.mil(10), unit.tsd(10), unit.hrd(10), unit.cen(10), unit.hts(10)
string ccur.desc(20)

#define TEXT.HANDLING {validate.textline()}

before.program:
e = rdi.domain( "tcdisc",
discount.format,
dummy.string,
dummy.string,
dummy.long,
dummy.string,
dummy.long)

e = rdi.domain( "tcamnt",
amount.format,
dummy.string,
dummy.string,
dummy.long,
dummy.string,
dummy.long)

e = rdi.domain.string(
domainof(r.paym.sched.payment.method.arr),
len.paym,
dummy.long)

r.slash = "/" |#800-184626.n

|******************************************************************************
|* BEFORE LAYOUTS
|******************************************************************************
before.r.copy.nr.10: |* Invoice Header
before.layout:
if r.document.type = cisli.doct.invoice and
r.source.type = tcsli.srtp.debit.credit then
r.doc.type.string = form.text$( "cislis255506",
lattr.language$)
else
|#1444682.sn
if r.document.type = cisli.doct.credit and
(r.source.type = tcsli.srtp.sales.order or
| r.source.type = tcsli.srtp.wareh.order or |#LND2-5420.o
r.source.type = tcsli.srtp.service.order or
r.source.type = tcsli.srtp.service.contr or
r.source.type = tcsli.srtp.project) then
|* For Germany negative invoices should be marked
|* as "Korrekturrechnung" and not as "Gutschrift"
r.doc.type.string = form.text$( "cislis255517",
lattr.language$)
else |#1444682.en
r.doc.type.string = enum.descr$(
domainof(r.document.type),
r.document.type,
lattr.language$)
endif |#1444682.n
endif

before.r.copy.nr.20: |* Invoice Header
before.layout:
if r.document.type = cisli.doct.invoice and
r.source.type = tcsli.srtp.debit.credit then
r.doc.type.string = form.text$( "cislis255506",
lattr.language$)
else
|#1444682.sn
if r.document.type = cisli.doct.credit and
(r.source.type = tcsli.srtp.sales.order or
| r.source.type = tcsli.srtp.wareh.order or |#LND2-5420.o
r.source.type = tcsli.srtp.service.order or
r.source.type = tcsli.srtp.service.contr or
r.source.type = tcsli.srtp.project) then
|* For Germany negative invoices should be marked
|* as "Korrekturrechnung" and not as "Gutschrift"
r.doc.type.string = form.text$( "cislis255517",
lattr.language$)
else |#1444682.en
r.doc.type.string = enum.descr$(
domainof(r.document.type),
r.document.type,
lattr.language$)
endif |#1444682.n
endif

before.r.copy.nr.25: |* Empty Header Line
after.layout:
remaining.empty.header.lines = remaining.empty.header.lines - 1
if remaining.empty.header.lines > 0 then
layout.again()
endif

before.r.copy.nr.50: |* Invoice Header
before.layout:
message("before.r.copy.nr.50: %s", r.ih.trns.typ & " " & str$(r.ih.doc.nr))

select cisli305.*
from cisli305
where cisli305.tran = :r.ih.trns.typ and cisli305.idoc = :r.ih.doc.nr
selectdo
if cisli305.ofad = cisli305.stoa then
ship_to = ""
else
ship_to = "Delivered To : "
get.del.contact()
endif
endselect

get.customer.contact()

| lattr.pageno = 1
remaining.empty.header.lines = r.no.empty.hdlin
| r.transport.amount = 0.0
| r.paym.sched.tot.amount = 0.0 |#1583946.o
r.end.invoice = false

invoice.date = get.report.invoice.date(
r.invoice.comp,
r.print.option,
| r.billing.req.id, |#1061448.o
r.invoicing.batch, |#1061448.n
r.ih.idat)


before.r.copy.nr.56: |#800-179260.sn
before.layout:
if r.invoice.origin = 6 then
|* Service Contracts do not have a ship-to address.
lattr.print = false
endif |#800-179260.en

before.r.shipto.loca.add.27: |#800-179260.sn
before.layout:
if r.invoice.origin = 6 then
|* Service Contracts do not have a ship-to address.
lattr.print = false
endif |#800-179260.en

before.r.copy.nr.81:
before.layout:
message("before.r.copy.nr.81: %s", r.ih.trns.typ & " " & str$(r.ih.doc.nr))

|before.r.copy.nr.82:
|before.layout:
| select cisli310.*
| from cisli310
| where cisli310.tran = :r.ih.trns.typ and cisli310.idoc = :r.ih.doc.nr
| selectdo
| endselect
|
| select tcibd001.*
| from tcibd001
| where tcibd001.item = :cisli310.item
| selectdo
| weight = round((tcibd001.cdf_lent * tcibd001.cdf_lewt), 3, 1) * r.delv.qty.iou
| endselect
|
|after.layout:
| calculate.total.quantity(r.delv.qty.iou)
| calculate.total.weight(weight)



|before.r.sort.key30.50: |* Delivery Note
|before.layout:
| delivery.notes = strip$(r.delv.notes)
| length.delivery.notes = len(delivery.notes)
| if length.delivery.notes > 100 then
| pos.of.next.delivery.note = rpos(delivery.notes(1;100)," ")
| else
| pos.of.next.delivery.note = 100
| endif
|
| r.delv.note = delivery.notes(1;pos.of.next.delivery.note)
| delivery.notes = delivery.notes(pos.of.next.delivery.note + 1)
|
|before.r.sort.key30.51: |* Delivery Note
|before.layout:
| length.delivery.notes = len(delivery.notes)
| if length.delivery.notes > 132 then
| pos.of.next.delivery.note = rpos(delivery.notes(1;132)," ")
| else
| pos.of.next.delivery.note = 132
| endif
|
| r.delv.note = delivery.notes(1;pos.of.next.delivery.note)
| delivery.notes = delivery.notes(pos.of.next.delivery.note + 1)
|
|after.layout:
| if not isspace(delivery.notes) then
| layout.again()
| endif

|******************************************************************************
|* DETAIL LAYOUTS
|******************************************************************************

detail.1: |#243517.sn
before.layout:
initialize.invoice.line.data() |#243517.en

select cisli310.*
from cisli310
where cisli310.tran = :r.ih.trns.typ and cisli310.idoc = :r.ih.doc.nr
selectdo
endselect

select tcibd001.*
from tcibd001
where tcibd001.item = :cisli310.item
selectdo
weight = round((tcibd001.cdf_lent * tcibd001.cdf_lewt), 3, 1) * r.delv.qty.iou
endselect

layout.again()

after.layout:
calculate.total.quantity(r.delv.qty.iou)
calculate.total.weight(weight)


|detail.6: |#800-179680.sn
|detail.7: |#REL_INV.o
detail.9: |#REL_INV.n
before.layout:
r.210.irdt.label = form.text$("cislis21102")
|* Interest as on Date
r.210.irai.label = form.text$("cislis21101")
|* Open Invoice Amount |#800-179680.en

detail.13: |#1451250.sn
before.layout:
if r.no.of.configs > 0 then
if configurations.counter <= r.no.of.configs then
|* no need to pass counter, function will get next config.
dummy.bool = ciint.dlltsctm.read.service.contract.config(
r.logistical.comp,
r.order.nr,
r.order.line,
r.config.line,
r.cluster,
r.config.item,
r.item.serial.num)
else
lattr.print = false
endif
endif
after.layout:
if configurations.counter < r.no.of.configs then
configurations.counter = configurations.counter + 1
layout.again()
endif |#1451250.en
|#1398488.sn
detail.18: |* Service Activity
before.layout:
if r.aggregated.line and r.activity = 0 then
lattr.print = false
endif |#1398488.en


detail.30: |* Kit Item Label
before.layout:
if not print.sales.order.invoice.component.lines(
r.kitting.order,
r.print.kit.comp,
r.delv.qty.iiu) then
lattr.print = false
endif

detail.31: |* Invoice Line (Amount, Discount)
before.layout:
| initialize.invoice.line.data() |#243517.o

r.print.discount.value = false |#1504265.n

|* In the discount column either the discount percentage or
|* discount amount is printed. Formatting this field is done here.
| if r.disc.perct.arr(1) <> 0 then
if double.cmp( r.disc.perct.arr(1),
0.0,
0.0001) <> 0 then
|* percentage should be printed.
r.print.discount.value = true |#1504265.n
|* Print discount percentage according format
r.discount = sprintf$("%@" & discount.format & "@",
r.disc.perct.arr(1))
| r.discount = shiftr$(r.discount) |#800-170429.o
r.discount = shiftr$(r.discount) & " %" |#800-170429.n

|* Shorten the print condition |#1398488.sn
if r.print.gross.net<>tcgrnt.nett then
r.print.discount = true
else
r.print.discount = false
endif |#1398488.en

else
|* No discount percentage defined. Hence print discount amount
|* according format. This is only applicable for sales invoices.
if r.invoice.origin = 4 then
r.discount =
sprintf$(amount.format & "," & r.ih.ccur,
r.disc.amount.arr(1))
r.discount = shiftr$(r.discount)
| if val(r.discount) <> 0.00 then
if double.cmp( val(r.discount), |#1504265.sn
0.0,
0.0001) <> 0 then
r.print.discount.value = true
endif |#1504265.en
endif
endif

after.layout:
r.transport.amount = r.transport.amount + r.amount

detail.32: |* Discounts
before.layout:
|* Determine number of discount lines to be printed.
|* note that the first discount element is already printed in detail.31
if r.invoice.origin = 4 and
no.disc.lines = 0 then
for ii = 2 to MAX.NO.DISCOUNTS
| if r.disc.perct.arr(ii) <> 0 or
if double.cmp( r.disc.perct.arr(ii),
0.0,
0.0001) <> 0 or
not EQUAL.TO(domainof(r.disc.amount.arr),
r.disc.amount.arr(ii), 0.0) then
no.disc.lines = ii
endif
endfor
endif

|* In the discount column either the discount percentage or
|* discount amount is printed. Formatting this field is done here.
if r.invoice.origin = 4 and
r.disc.element <= no.disc.lines then
| if r.disc.perct.arr(r.disc.element) <> 0 then
if double.cmp( r.disc.perct.arr(r.disc.element),
0.0,
0.0001) <> 0 then
|* Print discount percentage according format
r.discount =
sprintf$("%@" & discount.format & "@",
r.disc.perct.arr(r.disc.element))
| r.discount = shiftr$(r.discount) |#800-170429.o
r.discount = shiftr$(r.discount) & " %" |#800-170429.n
else
|No discount percentage defined.
|Hence print discount amount according format
r.discount =
sprintf$(amount.format & "," & r.ih.ccur,
r.disc.amount.arr(r.disc.element))
r.discount =
shiftr$(r.discount)
endif
else
lattr.print = false
endif

after.layout:
if r.disc.element <= no.disc.lines then
r.disc.element = r.disc.element + 1
layout.again()
endif

detail.33: |#800-192539.sn
before.layout:
if r.order.unit.dsun <> r.price.unit.dsun and
not r.aggregated.line and
not r.hide.price then
lattr.print = true
else
lattr.print = false
endif |#800-192539.en

detail.65: |* Tax Code
before.layout:
ciint.dlltctax.get.tax.rounding.method(
r.ih.fin.comp,
tax.rounding.method)
r.tax.rounding.method = tax.rounding.method

detail.90: |* Lots and Serials
before.layout:
if lot.serial.element <= r.no.lots.serials then
|#1419676.so
| r.lot.serial.string = r.lots.serials(1, lot.serial.element)
|#1419676.eo
|#1419676.sn
r.lot.serial.str = r.lots.serials(1, lot.serial.element)
|#1419676.en
if not EQUAL.TO(domainof(r.lot.qty),
r.lot.qty(lot.serial.element),
0.0) then
|#1419676.so
| r.lot.serial.string =
| strip$(r.lot.serial.string) & " " &
| str$(r.lot.qty(lot.serial.element))
|#1419676.eo
|#1419676.sn
r.lot.serial.str =
strip$(r.lot.serial.str) & " " &
str$(r.lot.qty(lot.serial.element))
|#1419676.en
endif
else
lattr.print = false
endif

after.layout:
if lot.serial.element < r.no.lots.serials then
lot.serial.element = lot.serial.element + 1
layout.again()
r.lot.serial.line = true |#1419676.sn
rpi.write.additional.row()
r.lot.serial.line = false |#1419676.en
endif

detail.135: |* Kitting Components
before.layout:
if not print.sales.order.invoice.component.lines(
r.kitting.order,
r.print.kit.comp,
r.delv.qty.iiu) then
lattr.print = false
else
| handle.sales.order.invoice.component.lines(
| r.logistical.comp,
| r.order.type,
| tckoor.act.sls,
| r.order.nr,
| r.order.set,
| r.order.line,
| r.invoice.line,
| r.shipment.id)
|#800-191132.so
| handle.sales.order.invoice.component.lines(
| r.ih.fin.comp,
| r.ih.trns.typ,
| r.ih.doc.nr,
| r.invoice.line)
|#800-191132.eo

if r.print.option = cisli.prno.draft then |#1869550.sn
handle.billable.line.component.lines(
r.logistical.comp,
r.source.type,
r.order.nr,
r.order.line,
r.order.reference,
r.tech.reference,
r.billing.seqn)
else |#1869550.en
|#800-191132.sn
handle.sales.order.invoice.component.lines(
r.logistical.comp,
| r.order.type, |#citcslisrtp.o
r.source.type, |#citcslisrtp.n
tckoor.act.sls,
r.order.nr,
r.order.set,
r.order.line,
r.order.sequence,
r.shipment.id)
|#800-191132.en
endif |#1869550.n
endif
after.layout:
if g.actual.component.line < g.max.no.of.components then
layout.again()
else
g.actual.component.line = 0
g.arrays.filled = false
free.mem(g.component.shipment)
free.mem(g.component.shipment.line)
free.mem(g.component.receipt) |#800-176216.n
free.mem(g.component.receipt.line) |#800-176216.n
free.mem(g.component)
free.mem(g.delivered.qty.inv.unit)
free.mem(g.delivered.qty.order.unit)
free.mem(g.order.unit)
free.mem(g.conversion.factor)
free.mem(g.delivery.date)
free.mem(g.terms.of.delivery)
free.mem(g.point.of.title.passage)
free.mem(g.lot.and.serial.set)
free.mem(g.route)
free.mem(g.carrier.lsp)
free.mem(g.component.text)
free.mem(g.item.text)
endif

detail.200: |* Tax Summary
before.layout:
initialize.tax.summary.data()

| need(8 + g.no.of.records) |#aggr_tax.o
need(8 + (g.no.of.records * 2)) |#aggr_tax.n

|detail.201: |* Tax Summary - Tax by Tax Authority |#1001034.o
detail.210: |* Tax Summary - Tax by Tax Authority |#1001034.n
before.layout:
| if not g.tax.authority.present then
r.tax.text = 0 |#aggr_tax.n
if g.no.of.records = 0 or |#mah.n
(g.current.tax.authority.record <= g.no.of.records and
isspace(r.ts.tax.country.array(
1,
g.current.tax.authority.record))) then
lattr.print = false
else
r.tax.country = r.ts.tax.country.array( |#aggr_tax.sn
1, g.current.tax.authority.record)
r.tax.code = r.ts.line.tax.code.array(
1, g.current.tax.authority.record)
|#aggr_tax.en
r.tax.authority = r.ts.tax.authority(
1, g.current.tax.authority.record)
r.tax.authority.desc = r.ts.tax.authority.desc(
1, g.current.tax.authority.record)
if not isspace(r.tax.authority.desc) then |#1502299.sn
r.tax.line.exempt = r.ts.tax.line.exempt(
g.current.tax.authority.record)
else
r.tax.line.exempt = empty
endif |#1502299.en
r.tax.authority.exempt = r.ts.tax.authority.exempt(
1, g.current.tax.authority.record)
r.tax.authority.base.am = r.ts.tax.authority.base.am(
g.current.tax.authority.record)
r.tax.authority.percent = r.ts.tax.authority.percent(
g.current.tax.authority.record)
r.tax.authority.am = r.ts.tax.authority.am(
g.current.tax.authority.record)
r.tax.authority.am.hc = r.ts.tax.authority.am.hc(
g.current.tax.authority.record, 1)
ciint.dlltcmcs.get.text.of.tax.code( |#aggr_tax.sn
r.tax.country,
r.tax.code,
g.tax.text)
r.tax.text = g.tax.text |#aggr_tax.en
endif
after.layout:
if g.current.tax.authority.record < g.no.of.records then
inc(g.current.tax.authority.record)
layout.again()
endif
|#aggr_tax.so
||detail.202: |* Tax Summary - Tax by Tax Code |#1001034.o
|detail.215: |* Tax Summary - Tax by Tax Code |#1001034.n
|before.layout:
|| if not g.tax.code.present then
| if g.no.of.records = 0 or |#mah.n
| (g.current.tax.text.record <= g.no.of.records and
| isspace(r.ts.tax.country.array(
| 1,
| g.current.tax.text.record))) then
| lattr.print = false
| else
| r.tax.country = r.ts.tax.country.array(
| 1, g.current.tax.text.record)
|| r.tax.code = r.ts.tax.code.array( |#aggr_tax.o
| r.tax.code = r.ts.line.tax.code.array( |#aggr_tax.n
| 1, g.current.tax.text.record)
|| if not isspace(g.current.tax.country) and
|| not isspace(g.current.tax.code) and
|| g.current.tax.country = r.tax.country and
|| g.current.tax.code = r.tax.code then
|| |* In case of multiple tax, the tax code should be
|| |* printed only once in the tax summary.
|| inc(g.current.tax.code.record)
|| lattr.print = false
|| endif
| r.tax.text = 0
| ciint.dlltcmcs.get.text.of.tax.code(
| r.tax.country,
| r.tax.code,
| g.tax.text)
| r.tax.text = g.tax.text
|| g.current.tax.country = r.tax.country
|| g.current.tax.code = r.tax.code
| endif
|after.layout:
|| if g.current.tax.code.record < g.no.of.records then
| if g.current.tax.code.record < g.no.of.records then
| inc(g.current.tax.code.record)
| layout.again()
| endif |#aggr_tax.eo

|detail.203: |* Tax Summary |#1001034.o
detail.220: |* Tax Summary - Internal tax |#1001034.n
before.layout:
| if not g.tax.authority.present and
| not g.tax.code.present then
| if g.current.tax.authority.record < g.no.of.records or
| g.current.tax.code.record < g.no.of.records then
if g.current.tax.authority.record < g.no.of.tax.codes then
lattr.print = false
endif
after.layout:
closing.tax.summary.data()

detail.240: |* Tax Summary - External Tax
before.layout:
initialize.tax.summary.data()

need(8 + g.no.of.records)

detail.250: |* Tax Summary - Tax by Tax Authority |#1001034.sn
before.layout:
if g.no.of.records = 0 or
(g.current.tax.authority.record <= g.no.of.records and
isspace(r.ts.tax.country.array(
1,
g.current.tax.authority.record))) then
lattr.print = false
else
r.tax.authority = r.ts.tax.authority(
1, g.current.tax.authority.record)
r.tax.authority.desc = r.ts.tax.authority.desc(
1, g.current.tax.authority.record)
if not isspace(r.tax.authority.desc) then |#1502299.sn
r.tax.line.exempt = r.ts.tax.line.exempt(
g.current.tax.authority.record)
else
r.tax.line.exempt = empty
endif |#1502299.en
r.tax.authority.exempt = r.ts.tax.authority.exempt(
1, g.current.tax.authority.record)
r.tax.authority.base.am = r.ts.tax.authority.base.am(
g.current.tax.authority.record)
r.tax.authority.percent = r.ts.tax.authority.percent(
g.current.tax.authority.record)
r.tax.authority.am = r.ts.tax.authority.am(
g.current.tax.authority.record)
r.tax.authority.am.hc = r.ts.tax.authority.am.hc(
g.current.tax.authority.record, 1)
r.jurisdiction.level = r.ts.juris.level(
1, g.current.tax.authority.record)
endif
after.layout:
if g.current.tax.authority.record < g.no.of.records then
inc(g.current.tax.authority.record)
layout.again()
endif |#1001034.en

detail.260: |* Tax Summary - External Tax |#1001034.n
before.layout:
if g.current.tax.code.record < g.no.of.tax.codes then
lattr.print = false
endif
after.layout:
closing.tax.summary.data()

|#lnd-8235.sn
detail.140: |* Material Pricing
before.layout:
if mpr.current.line <= r.mpr.num.lines then
r.mpr.line = r.mpr.line.arr(mpr.current.line)
r.mpr.material = r.mpr.material.arr(1,mpr.current.line)
r.mpr.mat.desc = r.mpr.material.description.arr(1,mpr.current.line)
r.mpr.cont.quan = r.mpr.content.quantity.arr(mpr.current.line)
r.mpr.mat.unit = r.mpr.material.unit.arr(1,mpr.current.line)
r.mpr.quan.fact = r.mpr.quantity.factor.arr(mpr.current.line)
r.mpr.bill.fact = r.mpr.billable.quantity.factor.arr(mpr.current.line)
r.mpr.base.price = r.mpr.base.price.arr(mpr.current.line)
r.mpr.price.unit = r.mpr.price.unit.arr(1,mpr.current.line)
r.mpr.tot.base = r.mpr.tot.base.price.arr(mpr.current.line)
r.mpr.actual.pric = r.mpr.actual.price.arr(mpr.current.line)
r.mpr.tot.actual = r.mpr.tot.actual.price.arr(mpr.current.line)
r.mpr.man.actual = r.mpr.manual.actual.price.arr(mpr.current.line)
r.mpr.manual = r.mpr.manual.arr(mpr.current.line)
r.mpr.line.text = r.mpr.text.arr(mpr.current.line)
|#BP-suramnt.sn
r.mpr.surch.amnt = r.mpr.surch.amnt.arr(mpr.current.line)
|#BP-suramnt.en
else
lattr.print = false
endif

after.layout:
if mpr.current.line < r.mpr.num.lines then
inc(mpr.current.line)
layout.again()
r.mpr.is.detail = true
rpi.write.additional.row()
r.mpr.is.detail = false
endif |#lnd-8235.en

|******************************************************************************
|* AFTER LAYOUTS
|******************************************************************************
after.r.copy.nr.5:
before.layout:
r.end.invoice = true

|after.r.copy.nr.10: |* Tax Summary
|before.layout:
| need(calculate.needed.lines.for.tax.summary(
| r.ih.fin.comp,
| r.ih.trns.typ,
| r.ih.doc.nr))
| if draft.print then
| alloc.mem(tax.country,d.length(4),array.index.2)
| import("tax.country",tax.country)
| alloc.mem(tax.id.array, d.length(5), array.index.2)
| import("tax.id.array",tax.id.array)
| if tax.amounts.by.authority then
| alloc.mem(tax.authority, d.length(1), array.index.1)
| import("tax.authority", tax.authority)
| alloc.mem(tax.authority.desc,d.length(2), array.index.1)
| import("tax.authority.desc",tax.authority.desc)
| alloc.mem(tax.exempt.numb,d.length(3), array.index.1)
| import("tax.exempt.numb",tax.exempt.numb)
| alloc.mem(tax.base.amnt.inv, array.index.1)
| import("tax.base.amnt.inv",tax.base.amnt.inv)
| alloc.mem(tax.percent,array.index.1)
| import("tax.percent",tax.percent)
| alloc.mem(tax.amnt.inv,array.index.1)
| import("tax.amnt.inv",tax.amnt.inv)
| alloc.mem(tax.amnt.home,array.index.1,no.currencies)
| import("tax.amnt.home",tax.amnt.home)
| endif
| endif
|
| tax.by.tax.authority = false
| sql.id.tax.authority = sql.parse(
| "select cisli209.ctau:r.tax.authority, " &
| "cisli209.dsca:r.tax.authority.desc, " &
| "cisli209.exno:r.tax.authority.exempt, " &
| "cisli209.tbai:r.tax.authority.base.am, " &
| "cisli209.perc:r.tax.authority.percent, " &
| "cisli209.txai:r.tax.authority.am, " &
| "cisli209.txah:r.tax.authority.am.hc " &
| "from cisli209 " &
| "where cisli209._index1 = {:r.ih.fin.comp, " &
| ":r.ih.trns.typ, " &
| ":r.ih.doc.nr} ")
| sql.exec(sql.id.tax.authority)
|
| if not sql.fetch(sql.id.tax.authority) then
| tax.by.tax.authority = true
| else
| sql.close(sql.id.tax.authority)
| endif
|
| tax.by.tax.code = false
| sql.id.tax.code = sql.parse(
| "select cisli206.txct:r.tax.country, " &
| "cisli206.txid:r.tax.code " &
| "from cisli206 " &
| "where cisli206._index1 = {:r.ih.fin.comp, " &
| ":r.ih.trns.typ, " &
| ":r.ih.doc.nr} ")
|
| sql.exec(sql.id.tax.code)
|
| if not sql.fetch(sql.id.tax.code) then
| tax.by.tax.code = true
| else
| sql.close(sql.id.tax.code)
| endif
|
| if not tax.by.tax.authority and
| not tax.by.tax.code then
| lattr.print = false
| endif

|after.r.copy.nr.11: |* Tax Summary - Tax by Tax Authority
|before.layout:
| if not tax.by.tax.authority then
| lattr.print = false
| endif
|
|after.layout:
| if not sql.fetch(sql.id.tax.authority) then
| layout.again()
| else
| lattr.print = false
| sql.close(sql.id.tax.authority)
| endif

|after.r.copy.nr.12: |* Tax Summary - Tax by Tax Code
|before.layout:
| if not tax.by.tax.code then
| lattr.print = false
| else
| r.tax.text = 0
| select tcmcs036.txta:r.tax.text
| from tcmcs036
| where tcmcs036._index1={ :r.tax.country,
| :r.tax.code}
| as set with 1 rows
| selectdo
| endselect
| endif

|after.layout:
| if not sql.fetch(sql.id.tax.code) then
| layout.again()
| else
| lattr.print = false
| sql.close(sql.id.tax.code)
| endif

|after.r.copy.nr.13: |* Tax Summary
|before.layout:
| if not tax.by.tax.authority and
| not tax.by.tax.code then
| lattr.print = false
| endif


after.r.copy.nr.24:
before.layout:
skip.to(spool.pg.length - 15)

total.amount = r.ih.am.goods + r.ih.am.tax
total.qty = s.total.qty
total.wght = s.total.wght


if r.ih.trns.typ = "SIN" or r.ih.trns.typ = "S01" then

amt.txt =edit$(round(total.amount,2,1), "99999999VD99")

str.B =amt.txt(2;1) |get million
chr.sgl =str.B
get.chrsgl()
word.B = word.sgl

str.A = amt.txt(1;1)
chr.ten = Str.A
get.chrten()
word.A = word.ten

if str.A ="1" then
word.B =""
endif


if val(amt.txt(1;2)) >0 then
unit.mil ="million "
else unit.mil = ""
endif

str.C =amt.txt(3;1) |get hundred thousand
chr.sgl =str.C
get.chrsgl()
word.C = word.sgl

if val(str.c) >0 then
unit.hts ="hundred "
else unit.hts = ""
endif

str.E =amt.txt(5;1)
chr.sgl =str.E
get.chrsgl()
word.E = word.sgl

str.D = amt.txt(4;1)
chr.ten = Str.D
get.chrten()
word.D = word.ten

if str.D ="1" then
word.E =""
endif

if val(amt.txt(3;3)) >0 then
unit.tsd ="thousand "
else unit.tsd = ""
endif

str.F =amt.txt(6;1) |get hundred
chr.sgl =str.F
get.chrsgl()
word.F = word.sgl

if val(str.F) >0 then
unit.hrd ="hundred "
else unit.hrd = ""
endif

str.H =amt.txt(8;1)
chr.sgl =str.H
get.chrsgl()
word.H = word.sgl

str.G = amt.txt(7;1)
chr.ten = Str.G
get.chrten()
word.G = word.ten

if str.G ="1" then
word.H =""
endif

str.J =amt.txt(11;1)
chr.sgl =str.J
get.chrsgl()
word.J = word.sgl

str.I = amt.txt(10;1)
chr.ten = Str.I
get.chrten()
word.I = word.ten

if str.I ="1" then
word.J =""
endif

if val(amt.txt(10;2)) >0 then
if val(amt.txt(1;8)) > 0 then
unit.cen ="and cent "
else
unit.cen ="cent "
endif
else unit.cen = ""
endif

get.ccurdesc()

amt.inword = strip$(ccur.desc) & " " & word.A & word.B & unit.mil & word.C & unit.hts
& word.D & word.E & unit.tsd & word.F & unit.hrd
& word.G & word.H & unit.cen & word.I & word.J & "only"

amnt.word2 = toupper$(amt.inword)

else if r.ih.trns.typ = "SCN" then

amt.txt =edit$(round(total.amount,2,1), "-9999999VD99")

str.B =amt.txt(2;1) |get million
chr.sgl =str.B
get.chrsgl()
word.B = word.sgl

str.A = amt.txt(1;1)
chr.ten = Str.A
get.chrten()
word.A = word.ten

if str.A ="1" then
word.B =""
endif


if val(amt.txt(1;2)) >0 then
unit.mil ="million "
else unit.mil = ""
endif

str.C =amt.txt(3;1) |get hundred thousand
chr.sgl =str.C
get.chrsgl()
word.C = word.sgl

if val(str.c) >0 then
unit.hts ="hundred "
else unit.hts = ""
endif

str.E =amt.txt(5;1)
chr.sgl =str.E
get.chrsgl()
word.E = word.sgl

str.D = amt.txt(4;1)
chr.ten = Str.D
get.chrten()
word.D = word.ten

if str.D ="1" then
word.E =""
endif

if val(amt.txt(3;3)) >0 then
unit.tsd ="thousand "
else unit.tsd = ""
endif

str.F =amt.txt(6;1) |get hundred
chr.sgl =str.F
get.chrsgl()
word.F = word.sgl

if val(str.F) >0 then
unit.hrd ="hundred "
else unit.hrd = ""
endif

str.H =amt.txt(8;1)
chr.sgl =str.H
get.chrsgl()
word.H = word.sgl

str.G = amt.txt(7;1)
chr.ten = Str.G
get.chrten()
word.G = word.ten

if str.G ="1" then
word.H =""
endif

str.J =amt.txt(11;1)
chr.sgl =str.J
get.chrsgl()
word.J = word.sgl

str.I = amt.txt(10;1)
chr.ten = Str.I
get.chrten()
word.I = word.ten

if str.I ="1" then
word.J =""
endif

if val(amt.txt(10;2)) >0 then
if val(amt.txt(1;8)) > 0 then
unit.cen ="and cent "
else
unit.cen ="cent "
endif
else unit.cen = ""
endif

get.ccurdesc()

amt.inword = strip$(ccur.desc) & word.A & word.B & unit.mil & word.C & unit.hts
& word.D & word.E & unit.tsd & word.F & unit.hrd
& word.G & word.H & unit.cen & word.I & word.J & "only"

amnt.word2 = toupper$(amt.inword)

endif
endif

noted.bottom.1 = "E.& O.E."
noted.bottom.2 = "General terms and conditions of sales apply."
noted.bottom.3 = "We reserve the right to charge interest at the rate of 1.5% per month on overdue accounts."
noted.bottom.4 = "All cheques, should be made payable to Everlast Access Technologies Sdn. Bhd. and crossed 'A/C payee only'."
noted.bottom.5 = "Any discrepancy shall be served within 7 days hereof. Otherwise, the sales amount is considered final and fully accepted by you."
noted.bottom.6 = "This is a computer generated invoice. No signature required."




|after.r.copy.nr.25: |* Amounts by Document |#1061448.so
|before.layout:
| r.goods.net.amnt = r.ih.am.goods +
| r.ih.am.service +
| r.ih.am.cost +
| r.ih.am.rema -
| r.ih.am.disc -
| r.ih.settl.am |#1061448.eo

after.r.copy.nr.70: |* Payment Schedule by Document
before.layout:
if get.payment.schedule then
if not isspace(r.ih.terms.of.pay) and
| r.document.type <> cisli.doct.credit and |#FIN-083.o
not r.source.type = tcsli.srtp.debit.credit and
not IS.ZERO(r.ih.am) then
if not cisli.dll0063.get.due.date.and.due.amnt(
r.ih.fin.comp,
r.ih.itbp,
r.ih.pbbp,
r.ih.terms.of.pay,
r.ih.paym, |#1039380.n
r.ih.ccur,
r.ih.am,
0.0, |* VAT Amount
r.ih.idat,
no.paym.sched.lines,
r.paym.sched.amount.arr,
paym.sched.due.date.local.arr,
r.paym.sched.payment.method.arr,
dummy.error.message) then
return
endif
|#1039380.so
| if no.paym.sched.lines <> 0 and |#236047.sn
| not isspace(r.ih.paym) then
| |* Payment Method array is filled. The filling is
| |* done either from the Payment Schedule Lines or
| |* from the Invoice-to BP. In case of this last
| |* situation the payment method of the header should
| |* overrule.
| if not terms.of.payment.has.methods.on.schedule(
| r.ih.fin.comp,
| r.ih.terms.of.pay) then
| for ii = 1 to no.paym.sched.lines
| r.paym.sched.payment.method.arr(1,ii) =
| r.ih.paym
| endfor
| endif
| endif |#236047.en
|#1039380.eo
if no.paym.sched.lines = 0 then
no.paym.sched.lines = 1
|#1472358.so
| r.paym.sched.payment.method.arr(1,1) = r.ih.paym
|#1472358.eo
endif

alloc.mem(r.paym.sched.due.date.arr,
no.paym.sched.lines)

for ii = 1 to no.paym.sched.lines
local.to.utc(
paym.sched.due.date.local.arr(ii),
time.num(),
r.paym.sched.due.date.arr(ii))
endfor
else
no.paym.sched.lines = 1
alloc.mem(r.paym.sched.due.date.arr, 1)
alloc.mem(r.paym.sched.amount.arr, 1)
alloc.mem(r.paym.sched.payment.method.arr, len.paym, 1)
r.paym.sched.due.date.arr(1) = r.due.date
r.paym.sched.amount.arr(1) = r.ih.am
r.paym.sched.payment.method.arr(1,1) = r.ih.paym
endif

| r.paym.sched.tot.amount = 0.0 |#1583946.o
r.ps.total.amount = 0.0 |#1583946.n

alloc.mem(r.paym.sched.amount.eur.arr, no.paym.sched.lines)
for ii = 1 to no.paym.sched.lines
|#1583946.so
| r.paym.sched.tot.amount = r.paym.sched.tot.amount +
| r.paym.sched.amount.arr(ii)
|#1583946.eo
r.ps.total.amount = r.ps.total.amount +
r.paym.sched.amount.arr(ii)

if r.print.euro = tcyesno.yes then
convert.amount.to.euro(
r.ih.fin.comp,
r.ih.ccur,
r.paym.sched.amount.arr(ii),
r.ih.idat,
r.ih.rate.type,
| r.paym.sched.euro, |#1583946.o
r.ps.euro, |#1583946.n
r.paym.sched.amount.eur.arr(ii))
else
e = set.mem(r.paym.sched.amount.eur.arr, 0.0)
endif
endfor

get.payment.schedule = false
| r.paym.sched.element = 1 |#1583946.o
r.ps.element = 1 |#1583946.n
endif

| if r.paym.sched.element > no.paym.sched.lines then |#1583946.o
if r.ps.element <= no.paym.sched.lines then |#1583946.sn
r.ps.due.date = r.paym.sched.due.date.arr(r.ps.element)
r.ps.amount = r.paym.sched.amount.arr(r.ps.element)
r.ps.paym.method = r.paym.sched.payment.method.arr(1,r.ps.element)
r.ps.amount.eur = r.paym.sched.amount.eur.arr(r.ps.element)
else |#1583946.en
lattr.print = false
endif

after.layout:
| if r.paym.sched.element <= no.paym.sched.lines then |#1583946.o
if r.ps.element <= no.paym.sched.lines then |#1583946.sn
r.ps.line = true
rpi.write.additional.row()
r.ps.line = false |#1583946.en

| r.paym.sched.element = r.paym.sched.element + 1 |#1583946.o
inc(r.ps.element) |#1583946.n
layout.again()
else
free.mem(paym.sched.due.date.local.arr)
free.mem(r.paym.sched.amount.arr)
free.mem(r.paym.sched.payment.method.arr)
free.mem(r.paym.sched.due.date.arr)
endif

after.r.copy.nr.110: |* Payment Slip
before.layout:
|* Payment slip should always be printed at the bottom of the page.
|* Layout length of r.copy.nr.85 = 23
skip.to(spool.pg.length - 23)

|******************************************************************************
|* TEXTS
|******************************************************************************

field.r.header.text:
before.print:
TEXT.HANDLING

field.r.add.text:
before.print:
TEXT.HANDLING

field.r.footer.text:
before.print:
TEXT.HANDLING

field.r.detail.text:
before.print:
TEXT.HANDLING

field.r.line.text1:
before.print:
TEXT.HANDLING

field.r.line.text2:
before.print:
TEXT.HANDLING

field.r.comp.text:
before.print:
TEXT.HANDLING

field.r.comp.item.text:
before.print:
TEXT.HANDLING

|field.r.rebate.agr.txt: |#800-196848.o
field.r.invoice.txt: |#800-196848.n
before.print:
TEXT.HANDLING

field.r.srv.item.text: |#1468471.sn
before.print:
TEXT.HANDLING

field.r.tax.text:
before.print:
TEXT.HANDLING

field.r.top.text:
before.print:
TEXT.HANDLING

field.r.tod.text:
before.print:
TEXT.HANDLING |#1468471.en

after.program:
free.mem(r.lots.serials)
free.mem(r.lot.qty)

free.mem(r.mpr.line.arr) |#lnd-8235.sn
free.mem(r.mpr.material.arr)
free.mem(r.mpr.material.description.arr)
free.mem(r.mpr.content.quantity.arr)
free.mem(r.mpr.material.unit.arr)
free.mem(r.mpr.quantity.factor.arr)
free.mem(r.mpr.billable.quantity.factor.arr)
free.mem(r.mpr.base.price.arr)
free.mem(r.mpr.price.unit.arr)
free.mem(r.mpr.tot.base.price.arr)
free.mem(r.mpr.actual.price.arr)
free.mem(r.mpr.tot.actual.price.arr)
free.mem(r.mpr.manual.actual.price.arr)
free.mem(r.mpr.manual.arr)
free.mem(r.mpr.text.arr) |#lnd-8235.en
free.mem(r.mpr.surch.amnt.arr) |#BP-suramnt.n

functions:
|#1039380.so
|function boolean terms.of.payment.has.methods.on.schedule( |#236047.sn
| domain tcncmp i.financial.company,
| domain tccpay i.terms.of.payment)
|{
| if ciint.dlltcmcs.terms.of.paym.has.methods.on.sched.lines(
| i.financial.company,
| i.terms.of.payment) then
| return(true)
| endif
|
| return(false)
|} |#236047.en
|#1039380.eo

|function domain tcmcs.long calculate.needed.lines.for.tax.summary(
| domain tcncmp i.financial.company,
| domain tfgld.ttyp i.transaction.type,
| domain tfgld.docn i.document.number)
|{
| domain tcmcs.long no.tax.authority.lines
| domain tcmcs.long no.tax.code.lines
|
| select count(*):no.tax.authority.lines
| from cisli209
| where cisli209._index1 = { :i.financial.company,
| :i.transaction.type,
| :i.document.number}
| as set with 1 rows
| selectdo
| endselect
|
| select count(*):no.tax.code.lines
| from cisli206
| where cisli206._index1 = { :i.financial.company,
| :i.transaction.type,
| :i.document.number}
| as set with 1 rows
| selectdo
| endselect
|
| return(8 + no.tax.authority.lines + no.tax.code.lines)
|}

function validate.textline()

{
|* Skip printing of internal text.
|* Internal text is text with on the first position the '<' sign.
|* External text is text with on the first position the '>' sign.

if ( lattr.prline(1;1) = ">" ) then
lattr.prline = lattr.prline(2)
else
if ( lattr.prline(1;1) = "<" ) then
lattr.print = false
endif
endif
}

function void initialize.tax.summary.data()
{
domain tcmcs.long array.index
domain tcmcs.long tax.authority.length
domain tcmcs.long description.length
domain tcmcs.long exempt.certificate.length
domain tcmcs.long jurisdiction.length |#1001034.n
domain tcmcs.long tax.country.length
domain tcmcs.long tax.code.length

domain tcmcs.long dummy.ret

array.index = 0
tax.authority.length = 0
description.length = 0
exempt.certificate.length = 0
tax.country.length = 0
tax.code.length = 0

import("r.ts.tax.summary", g.tax.summary)
import("r.ts.present", g.tax.code.present)
import("r.ts.tax.country.length", tax.country.length)
import("r.ts.tax.code.length", tax.code.length)
import("r.ts.no.home.currencies", g.no.of.home.currencies)
import("r.ts.array.index", array.index)
import("r.ts.no.tax.codes", g.no.of.tax.codes)
import("r.ts.tax.authority.length", tax.authority.length)
import("r.ts.description.length", description.length)
import("r.ts.exempt.certificate.length", exempt.certificate.length)
import("r.ts.jurisdiction.length", jurisdiction.length) |#1001034.n

if array.index > 0 then
dummy.ret = alloc.mem( r.ts.tax.country.array,
tax.country.length,
array.index)
dummy.ret = alloc.mem( r.ts.tax.code.array,
tax.code.length,
array.index)
|#aggr_tax.sn
dummy.ret = alloc.mem( r.ts.line.tax.code.array,
tax.code.length,
array.index) |#aggr_tax.en
dummy.ret = alloc.mem( r.ts.tax.authority,
tax.authority.length,
array.index)
dummy.ret = alloc.mem( r.ts.tax.authority.desc,
description.length,
array.index)
dummy.ret = alloc.mem( r.ts.tax.line.exempt, |#1502299.n
array.index) |#1502299.n
dummy.ret = alloc.mem( r.ts.tax.authority.exempt,
exempt.certificate.length,
array.index)
dummy.ret = alloc.mem( r.ts.tax.authority.base.am,
array.index)
dummy.ret = alloc.mem( r.ts.tax.authority.percent,
array.index)
dummy.ret = alloc.mem( r.ts.tax.authority.am,
array.index)
dummy.ret = alloc.mem( r.ts.tax.authority.am.hc,
array.index,
g.no.of.home.currencies)
dummy.ret = alloc.mem( r.ts.tax.text.array, |#1869187.n
array.index) |#1869187.n
dummy.ret = alloc.mem( r.ts.juris.level, |#1001034.sn
jurisdiction.length,
array.index) |#1001034.en
import("r.ts.tax.country.array", r.ts.tax.country.array)
import("r.ts.tax.code.array", r.ts.tax.code.array)
|#aggr_tax.sn
import("r.ts.line.tax.code.array", r.ts.line.tax.code.array)
|#aggr_tax.en
import("r.ts.tax.authority", r.ts.tax.authority)
import("r.ts.tax.authority.desc", r.ts.tax.authority.desc)
|#1502299.sn
import("r.ts.tax.line.exempt", r.ts.tax.line.exempt)
|#1502299.en
import("r.ts.tax.authority.exempt", r.ts.tax.authority.exempt)
import("r.ts.tax.authority.base.am", r.ts.tax.authority.base.am)
import("r.ts.tax.authority.percent", r.ts.tax.authority.percent)
import("r.ts.tax.authority.am", r.ts.tax.authority.am)
import("r.ts.tax.authority.am.hc", r.ts.tax.authority.am.hc)
import("r.ts.tax.text.array", r.ts.tax.text.array) |#1869187.n
import("r.ts.juris.level", r.ts.juris.level) |#1001034.n
endif

g.current.tax.authority.record = 1
g.current.tax.code.record = 1
g.no.of.records = array.index
}

function void closing.tax.summary.data()
{
free.mem(r.ts.tax.country.array)
free.mem(r.ts.tax.code.array)
free.mem(r.ts.line.tax.code.array) |#aggr_tax.n
free.mem(r.ts.tax.authority)
free.mem(r.ts.tax.authority.desc)
free.mem(r.ts.tax.line.exempt) |#1502299.n
free.mem(r.ts.tax.authority.exempt)
free.mem(r.ts.tax.authority.base.am)
free.mem(r.ts.tax.authority.percent)
free.mem(r.ts.tax.authority.am)
free.mem(r.ts.tax.authority.am.hc)
free.mem(r.ts.tax.text.array) |#1869187.n
free.mem(r.ts.juris.level) |#1001034.n
}

function void initialize.invoice.line.data()
{
long string.length |#lnd-8235.n

no.disc.lines = 0
lot.serial.element = 1
mpr.current.line = 1 |#lnd-8235.n
r.disc.element = 2
no.paym.sched.lines = 0
get.payment.schedule = true
g.arrays.filled = false
g.actual.component.line = 0
g.max.no.of.components = 0
configurations.counter = 1 |#1451250.n
r.discount = "" |#247593.n
|#1419676.so
| r.no.lots.serials = 0 |#1025761.sn
| import("r.no.lots.serials", r.no.lots.serials) |#1025761.en
|#1419676.eo


if r.no.lots.serials > 0 then
alloc.mem(r.lots.serials, 100, r.no.lots.serials)
alloc.mem(r.lot.qty, r.no.lots.serials)
import("r.lots.serials", r.lots.serials)
import("r.lot.qty", r.lot.qty)
endif

if r.mpr.num.lines > 0 then |#lnd-8235.sn
alloc.mem(r.mpr.line.arr, r.mpr.num.lines)

rdi.domain.string("tcmpr.matr", string.length, dummy.long)
alloc.mem(r.mpr.material.arr, string.length, r.mpr.num.lines)

rdi.domain.string("tcdsca", string.length, dummy.long)
alloc.mem(r.mpr.material.description.arr,
string.length, r.mpr.num.lines)

rdi.domain.string("tccuni", string.length, dummy.long)
alloc.mem(r.mpr.material.unit.arr,
string.length, r.mpr.num.lines)
alloc.mem(r.mpr.price.unit.arr, string.length, r.mpr.num.lines)

alloc.mem(r.mpr.content.quantity.arr, r.mpr.num.lines)
alloc.mem(r.mpr.quantity.factor.arr, r.mpr.num.lines)
alloc.mem(r.mpr.billable.quantity.factor.arr, r.mpr.num.lines)
alloc.mem(r.mpr.base.price.arr, r.mpr.num.lines)
alloc.mem(r.mpr.tot.base.price.arr, r.mpr.num.lines)
alloc.mem(r.mpr.actual.price.arr, r.mpr.num.lines)
alloc.mem(r.mpr.tot.actual.price.arr, r.mpr.num.lines)
alloc.mem(r.mpr.manual.actual.price.arr, r.mpr.num.lines)
alloc.mem(r.mpr.manual.arr, r.mpr.num.lines)
alloc.mem(r.mpr.text.arr, r.mpr.num.lines)
|#BP-suramnt.sn
alloc.mem(r.mpr.surch.amnt.arr, r.mpr.num.lines)
|#BP-suramnt.en

import("r.mpr.line.arr", r.mpr.line.arr)
import("r.mpr.material.arr", r.mpr.material.arr)
import("r.mpr.material.description.arr",
r.mpr.material.description.arr)
import("r.mpr.content.quantity.arr", r.mpr.content.quantity.arr)
import("r.mpr.material.unit.arr", r.mpr.material.unit.arr)
import("r.mpr.quantity.factor.arr", r.mpr.quantity.factor.arr)
import("r.mpr.billable.quantity.factor.arr",
r.mpr.billable.quantity.factor.arr)
import("r.mpr.base.price.arr", r.mpr.base.price.arr)
import("r.mpr.price.unit.arr", r.mpr.price.unit.arr)
import("r.mpr.tot.base.price.arr", r.mpr.tot.base.price.arr)
import("r.mpr.actual.price.arr", r.mpr.actual.price.arr)
import("r.mpr.tot.actual.price.arr", r.mpr.tot.actual.price.arr)
import("r.mpr.manual.actual.price.arr",
r.mpr.manual.actual.price.arr)
import("r.mpr.manual.arr", r.mpr.manual.arr)
import("r.mpr.text.arr", r.mpr.text.arr)
|#BP-suramnt.sn
import("r.mpr.surch.amnt.arr", r.mpr.surch.amnt.arr)
|#BP-suramnt.en
endif |#lnd-8235.en
}

|function void handle.sales.order.invoice.component.lines(
| domain tcncmp i.source.logistic.company,
| domain cisli.ortp i.order.type,
| domain tckoor i.kind.of.order,
| domain tcorno i.sales.order,
| domain tcwset i.order.set,
| domain tcpono i.line.number,
| domain tcpono i.invoice.line,
| domain tcshpm i.shipment)
|#800-191132.so
|function void handle.sales.order.invoice.component.lines(
| domain tcncmp i.financial.company,
| domain tctran i.transaction.type,
| domain tcgld.docn i.invoice.number,
| domain tciseq i.invoice.line)
|#800-191132.eo
|#800-191132.sn
function void handle.sales.order.invoice.component.lines(
domain tcncmp i.logistic.company,
| domain cisli.ortp i.order.type, |#citcslisrtp.o
domain tcsli.srtp i.source.type, |#citcslisrtp.n
domain tckoor i.kind.of.order,
domain tcorno i.order.number,
domain tcwset i.order.set,
domain tcpono i.order.line,
domain tcpono i.order.invoice.line, |#LND2-8.n
| domain tcpono i.order.sequence, |#LND2-8.o
domain tcshpm i.shipment)
|#800-191132.en
{
domain tcmcs.long length.of.component.shipment
domain tcmcs.long length.of.component
domain tcmcs.long length.of.order.unit
domain tcmcs.long length.of.terms.of.delivery
domain tcmcs.long length.of.point.of.title.passage
domain tcmcs.long length.of.lot.and.serial.set
domain tcmcs.long length.of.route
domain tcmcs.long length.of.carrier.lsp

|#800-191132.sn
domain tcncmp financial.company
domain tctran transaction.type
domain tcgld.docn invoice.number
domain tciseq invoice.line


e = cisli.dll0310.get.invoice.line.from.sales.order.data(
i.logistic.company,
| i.order.type, |#citcslisrtp.o
i.source.type, |#citcslisrtp.n
i.kind.of.order,
i.order.number,
i.order.set,
i.order.line,
i.order.invoice.line, |#LND2-8.n
| i.order.sequence, |#LND2-8.o
i.shipment,
financial.company,
transaction.type,
invoice.number,
invoice.line)
|#800-191132.en

if not g.arrays.filled then
| cisli.dll0247.count.component.lines.of.sales.invoice.line(
| i.source.logistic.company,
| i.order.type,
| i.kind.of.order,
| i.sales.order,
| i.order.set,
| i.line.number,
| i.invoice.line,
| i.shipment,
| false, |* Do not force count.
| g.max.no.of.components)
cisli.dll0312.invoice.line.satellite.count.component.lines(
|#800-191132.so
| i.financial.company,
| i.transaction.type,
| i.invoice.number,
| i.invoice.line,
|#800-191132.eo
|#800-191132.sn
financial.company,
transaction.type,
invoice.number,
invoice.line,
|#800-191132.en
false, |* Do not force count.
g.max.no.of.components)
|#800-191132.sn
if g.max.no.of.components = 0 then
|* No component lines to print
return
endif
|#800-191132.en
dummy.long = rdi.domain.string(
"tcshpm",
length.of.component.shipment,
dummy.long)
dummy.long = rdi.domain.string(
"tcitem",
length.of.component,
dummy.long)
dummy.long = rdi.domain.string(
"tccuni",
length.of.order.unit,
dummy.long)
dummy.long = rdi.domain.string(
"tccdec",
length.of.terms.of.delivery,
dummy.long)
dummy.long = rdi.domain.string(
"tcptpa",
length.of.point.of.title.passage,
dummy.long)
dummy.long = rdi.domain.string(
"tcguid",
length.of.lot.and.serial.set,
dummy.long)
dummy.long = rdi.domain.string(
"tccrte",
length.of.route,
dummy.long)
dummy.long = rdi.domain.string(
"tccfrw",
length.of.carrier.lsp,
dummy.long)
alloc.mem( g.component.shipment,
length.of.component.shipment,
g.max.no.of.components)
alloc.mem( g.component.shipment.line,
g.max.no.of.components)
alloc.mem( g.component.receipt, |#800-176216.sn
length.of.component.shipment,
g.max.no.of.components)
alloc.mem( g.component.receipt.line,
g.max.no.of.components) |#800-176216.en
alloc.mem( g.logistic.company,
g.max.no.of.components)
alloc.mem( g.component,
length.of.component,
g.max.no.of.components)
alloc.mem( g.delivered.qty.inv.unit,
g.max.no.of.components)
alloc.mem( g.delivered.qty.order.unit,
g.max.no.of.components)
alloc.mem( g.order.unit,
length.of.order.unit,
g.max.no.of.components)
alloc.mem( g.conversion.factor,
g.max.no.of.components)
alloc.mem( g.delivery.date,
g.max.no.of.components)
alloc.mem( g.terms.of.delivery,
length.of.terms.of.delivery,
g.max.no.of.components)
alloc.mem( g.point.of.title.passage,
length.of.point.of.title.passage,
g.max.no.of.components)
alloc.mem( g.lot.and.serial.set,
length.of.lot.and.serial.set,
g.max.no.of.components)
alloc.mem( g.route,
length.of.route,
g.max.no.of.components)
alloc.mem( g.carrier.lsp,
length.of.carrier.lsp,
g.max.no.of.components)
alloc.mem( g.component.text,
g.max.no.of.components)
alloc.mem( g.item.text,
g.max.no.of.components)

| cisli.dll0247.sales.order.invoice.component.line.get.array(
| i.source.logistic.company,
| i.order.type,
| i.kind.of.order,
| i.sales.order,
| i.order.set,
| i.line.number,
| i.invoice.line,
| i.shipment,
cisli.dll0312.invoice.line.satellite.get.component.lines(
|#800-191132.so
| i.financial.company,
| i.transaction.type,
| i.invoice.number,
| i.invoice.line,
|#800-191132.eo
|#800-191132.sn
financial.company,
transaction.type,
invoice.number,
invoice.line,
|#800-191132.en
g.component.shipment,
g.component.shipment.line,
g.component.receipt, |#800-176216.sn
g.component.receipt.line,
|#800-176216.en
g.logistic.company,
g.component,
g.delivered.qty.inv.unit,
g.delivered.qty.order.unit,
g.order.unit,
g.conversion.factor,
g.delivery.date,
g.terms.of.delivery,
g.point.of.title.passage,
g.lot.and.serial.set,
g.route,
g.carrier.lsp,
g.component.text,
g.item.text)
g.arrays.filled = true
endif

inc(g.actual.component.line)
fill.report.fields.for.printing.kitting.components(
| i.source.logistic.company,
g.component.shipment(1, g.actual.component.line),
g.component.shipment.line(g.actual.component.line),
|#800-176216.sn
g.component.receipt(1, g.actual.component.line),
g.component.receipt.line(g.actual.component.line),
|#800-176216.en
g.logistic.company(g.actual.component.line),
g.component(1, g.actual.component.line),
g.delivered.qty.inv.unit(g.actual.component.line),
g.delivered.qty.order.unit(g.actual.component.line),
g.order.unit(1, g.actual.component.line),
g.conversion.factor(g.actual.component.line),
g.delivery.date(g.actual.component.line),
g.terms.of.delivery(1, g.actual.component.line),
g.point.of.title.passage(1, g.actual.component.line),
g.lot.and.serial.set(1, g.actual.component.line),
g.route(1, g.actual.component.line),
g.carrier.lsp(1, g.actual.component.line),
g.component.text(g.actual.component.line),
g.item.text(g.actual.component.line))
}

|#1869550.sn
function void handle.billable.line.component.lines(
domain tcncmp i.logistic.company,
domain tcsli.srtp i.source.type,
domain tcorno i.order.number,
domain tcpono i.order.line,
domain tcsli.oref i.order.reference,
domain tcsli.tref i.technical.reference,
domain tcpono i.billing.sequence)
{
if not g.arrays.filled then

if cisli.dll0812.get.billable.line.component.lines(
i.logistic.company,
i.source.type,
i.order.number,
i.order.line,
i.order.reference,
i.technical.reference,
i.billing.sequence,
g.max.no.of.components,
g.dummy.sequence,
g.component.shipment,
g.component.shipment.line,
g.component.receipt,
g.component.receipt.line,
g.component,
g.delivered.qty.inv.unit,
g.delivered.qty.order.unit,
g.order.unit,
g.conversion.factor,
g.delivery.date,
g.terms.of.delivery,
g.point.of.title.passage,
g.lot.and.serial.set,
g.route,
g.carrier.lsp,
g.component.text,
g.item.text) or
g.max.no.of.components = 0 then
|* No component lines to print
return
else
g.arrays.filled = true
endif
endif

inc(g.actual.component.line)
fill.report.fields.for.printing.kitting.components(
g.component.shipment(1, g.actual.component.line),
g.component.shipment.line(g.actual.component.line),
g.component.receipt(1, g.actual.component.line),
g.component.receipt.line(g.actual.component.line),
i.logistic.company,
g.component(1, g.actual.component.line),
g.delivered.qty.inv.unit(g.actual.component.line),
g.delivered.qty.order.unit(g.actual.component.line),
g.order.unit(1, g.actual.component.line),
g.conversion.factor(g.actual.component.line),
g.delivery.date(g.actual.component.line),
g.terms.of.delivery(1, g.actual.component.line),
g.point.of.title.passage(1, g.actual.component.line),
g.lot.and.serial.set(1, g.actual.component.line),
g.route(1, g.actual.component.line),
g.carrier.lsp(1, g.actual.component.line),
g.component.text(g.actual.component.line),
g.item.text(g.actual.component.line))
}
|#1869550.en

function boolean print.sales.order.invoice.component.lines(
domain tcyesno i.kit.handling,
boolean i.print.components.of.kit,
domain tcqsl1 i.delivered.quantity)
{
|* Components must be printed if:
|* - the setting of 'Print Components of Kit' is checked in the billing
|* request addition.
|* - the delivered quantity is zero.
|*
|* Note: if the delivered quantity is zero, then the setting of 'Print
|* Components of Kit' is ignored.

if i.kit.handling = tcyesno.no then
|* Sales Order Invoice Line does not have component lines in
|* cisli247 (Sales Order Invoice Component Lines).
return(false)
endif

if not i.print.components.of.kit and
NOT.ZERO(i.delivered.quantity) then
return(false)
endif

return(true)
}

function void fill.report.fields.for.printing.kitting.components(
| domain tcncmp i.source.logistic.company,
domain tcshpm i.component.shipment,
domain tcpono i.component.shipment.line,
domain tcshpm i.component.receipt, |#800-176216.sn
domain tcpono i.component.receipt.line,
|#800-176216.en
domain tcncmp i.logistic.company,
domain tcitem i.item,
domain tcqsl1 i.delivered.qty.inventory.unit,
domain tcqsl1 i.ordered.qty.sales.unit,
domain tccuni i.sales.unit,
domain tcconv i.conversion.factor,
domain tcdate i.delivery.date,
domain tccdec i.terms.of.delivery,
domain tcptpa i.point.of.title.passage,
domain tcguid i.lot.and.serial.set,
domain tccrte i.route,
domain tccfrw i.carrier.lsp,
domain tctxtn i.component.text,
domain tctxtn i.item.text)
{
domain tcdsca item.description
domain tcdsca route.description
domain tcdsca carrier.lsp.description
domain tccuni inventory.unit

boolean dummy.terms.of.del.desc.extended
domain tctxtn dummy.terms.of.del.text
long dummy.long

item.description = ""
inventory.unit = ""

r.component.item = i.item
ciint.dlltcibd.get.item.description(
i.logistic.company,
i.item,
item.description)
r.component.item.dsca = item.description
r.component.ordered.qty = i.ordered.qty.sales.unit
r.component.delivered.qty = i.delivered.qty.inventory.unit
r.component.sales.unit = i.sales.unit
if NOT.ZERO(i.conversion.factor) then
r.component.ordered.qty.inv = i.ordered.qty.sales.unit *
i.conversion.factor
r.component.delivered.qty.inv = i.delivered.qty.inventory.unit *
i.conversion.factor
else
r.component.ordered.qty.inv = i.ordered.qty.sales.unit
r.component.delivered.qty.inv = i.delivered.qty.inventory.unit
endif
ciint.dlltcibd.get.item.inventory.unit(
i.logistic.company,
i.item,
inventory.unit)
r.component.inventory.unit = inventory.unit

if cisli.dll1200.get.terms.of.delivery.data(
i.logistic.company, |#lnd2-5078.n
i.terms.of.delivery,
i.point.of.title.passage,
r.ship.from.cadr,
r.ship.to.cadr,
lattr.language$,
dummy.terms.of.del.desc.extended,
r.component.terms.of.delivery.dsca,
dummy.terms.of.del.text) then
r.component.terms.of.delivery.dsca = ""
endif

r.component.shipment = i.component.shipment
r.component.shipment.line = i.component.shipment.line
r.component.receipt = i.component.receipt |#800-176216.n
r.component.receipt.line = i.component.receipt.line |#800-176216.n
r.component.delivery.date = i.delivery.date
r.component.route = i.route
ciint.dlltcmcs.read.route.description(
i.logistic.company, |#lnd2-5078.n
i.route,
route.description)
r.component.route.dsca = route.description
r.component.carrier.lsp = i.carrier.lsp
dummy.long = ciint.dlltcmcs.get.description.of.carrier(
i.logistic.company, |#lnd2-5078.n
i.carrier.lsp,
carrier.lsp.description)
r.component.carrier.lsp.dsca = carrier.lsp.description
if i.component.text then
r.comp.text = i.component.text
r.component.text.label = tt.field.desc("cisli312.txta")
else
r.comp.text = 0
r.component.text.label = ""
endif
if i.item.text then
r.comp.item.text = i.item.text
r.item.text.label = tt.field.desc("cisli312.txtb")
else
r.comp.item.text = 0
r.item.text.label = ""
endif
}

function void convert.amount.to.euro(
domain tcncmp i.company,
domain tcccur i.invoice.currency,
domain tcamnt i.invoice.amount,
domain tcdate i.rate.date,
domain tcrtyp i.exchange.rate.type,
ref domain tcccur o.euro.ccur,
ref domain tfgld.amnt o.euro.amount)
{
|* translate EMU currency amount to Euros
o.euro.amount = 0
o.euro.ccur = ""

e = ciint.dlltfcmg.translate.emu.amount.into.euro.ext(
i.company,
i.invoice.currency,
i.invoice.amount,
i.rate.date,
i.exchange.rate.type,
o.euro.ccur,
o.euro.amount)
}

function domain tcgld.date get.report.invoice.date(
domain tcncmp i.invoice.company,
domain cisli.prno i.print.option,
| domain cisli.brid i.billing.request, |#fd49686.o
domain tcorno i.invoicing.batch, |#fd49686.n
domain tcdate i.invoice.date.utc)

{
domain tcgld.date report.invoice.date
domain cisli.user original.user
domain tctimz current.time.zone
domain tctimz original.time.zone
domain tcmcs.long dummy.time

if i.print.option = cisli.prno.reprint then
e = get.time.zone(current.time.zone)
select cisli200.user:original.user
from cisli200
where cisli200._index1 = { :i.invoice.company,
:i.invoicing.batch}
as set with 1 rows
selectdo
select ttams110.tzon:original.time.zone
from ttaad200, ttams110
where ttaad200.user = :original.user
and ttaad200.tusd = ttams110.ctmp
and ttaad200._compnr = 0
and ttams110._compnr = 0
as set with 1 rows
selectdo
endselect
e = set.time.zone(original.time.zone)
utc.to.local( i.invoice.date.utc,
|* Output
report.invoice.date,
dummy.time)
e = set.time.zone(current.time.zone)
endselect
else
utc.to.local( i.invoice.date.utc,
|*Output
report.invoice.date,
dummy.time)
endif

return(report.invoice.date)
}


function get.del.contact()
{
select tdsls400.*
from tdsls400
where tdsls400.stbp = :cisli305.stbp
selectdo

select tccom130.*
from tccom130
where tccom130.cadr = :cisli305.stoa
selectdo
del.name = tccom130.nama
endselect

select tccom140.*
from tccom140
where tccom140.ccnt = :tdsls400.stcn
selectdo
del.tel = "Tel: " & tccom140.telp
del.fax = "Fax: " & tccom140.tefx
del.attn = "Attn: " & tccom140.fuln
endselect
endselect
}


function get.customer.contact()
{
select tdsls400.*
from tdsls400
where tdsls400.ofbp = :cisli305.ofbp
selectdo
select tccom140.*
from tccom140
where tccom140.ccnt = :tdsls400.ofcn
selectdo
tel = "Tel: " & tccom140.telp
fax = "Fax: " & tccom140.tefx
attn = "Attn: " & tccom140.fuln
endselect
endselect
}


function calculate.total.quantity(domain tcqiv1 t.qty)
{
s.total.qty = s.total.qty + t.qty
}


function calculate.total.weight(domain tcwght t.wght)
{
s.total.wght = s.total.wght + t.wght
}


function get.chrsgl()
{
on case chr.sgl
case "0":
word.sgl = ""
break
case "1":
word.sgl = "one "
break
case "2":
word.sgl = "two "
break
case "3":
word.sgl = "three "
break
case "4":
word.sgl = "four "
break
case "5":
word.sgl = "five "
break
case "6":
word.sgl = "six "
break
case "7":
word.sgl = "seven "
break
case "8":
word.sgl = "eight "
break
case "9":
word.sgl = "nine "
break
endcase
}


function get.chrten()
{
on case chr.ten
case "0":
word.ten = ""
break
case "1":
word.sgl =""
on case chr.sgl
case "0":
word.ten = "ten "
break
case "1":
word.ten = "eleven "
break
case "2":
word.ten = "twelve "
break
case "3":
word.ten = "thirteen "
break
case "4":
word.ten = "fourteen "
break
case "5":
word.ten = "fifteen "
break
case "6":
word.ten = "sixteen "
break
case "7":
word.ten = "seventeen "
break
case "8":
word.ten = "eighteen "
break
case "9":
word.ten = "nineteen "
break
endcase
break
case "2":
word.ten = "twenty "
break
case "3":
word.ten = "thirty "
break
case "4":
word.ten = "forty "
break
case "5":
word.ten = "fifty "
break
case "6":
word.ten = "sixty "
break
case "7":
word.ten = "seventy "
break
case "8":
word.ten = "eighty "
break
case "9":
word.ten = "ninety "
break
endcase
}


function get.ccurdesc()
{
select tcmcs002.dsca
from tcmcs002
where tcmcs002.ccur = :r.ih.ccur

selectdo
ccur.desc = tcmcs002.dsca
endselect

ccur.desc = tcmcs002.dsca
}


|****************************** END OF REPORT SCRIPT ***************************



Please advise. Thanks.

mark_h
19th October 2017, 15:13
I would just put the report in debug mode and run one with just one record. Stepping thru the report to see if the session script was sending the record twice or if the report itself was just printing the record twice. That would tell you where you need to look - report or session script.

tracylee
20th October 2017, 04:15
I would just put the report in debug mode and run one with just one record. Stepping thru the report to see if the session script was sending the record twice or if the report itself was just printing the record twice. That would tell you where you need to look - report or session script.

Thanks for your reply. I think is session script sending the record twice. I try to put the message to show Invoices no., it is prompt the record twice. So, how can i to do it for my reporting side to show one time record? Because at session script I cannot do any modification. Please advise.

srprks
20th October 2017, 08:17
Hi,

In which detail section you are printing your SO, item and other details.

tracylee
20th October 2017, 09:03
Hi,

In which detail section you are printing your SO, item and other details.

Hi,

In detail.1. Please advise. Thanks.

srprks
20th October 2017, 11:51
Hi

1. What I see there is a layout.again() function is used. If possible try to comment that line.

2. Please use index in where clause of cisli310 and tcibd001.

Thanks