List of commits:
Subject Hash Author Date (UTC)
c1485 5a7f22188dcae14b979985c75feebb47388be676 gbg 2014-09-16 02:29:31
K2155 2e7558f7db2b6e31da2519cad202b86da09adb9b nac 2014-09-04 01:01:16
k2155 86ded46bdb75580f51d14ba9b9d02c5b0e74199b nac 2014-09-04 00:58:06
c1474 1e6975340fddfad71c1da85972c906b15ad455c3 nac 2014-07-28 03:16:10
c1474 5abda4b993a526d461af27de8e74b352f173e775 gbg 2014-07-03 14:15:32
Update tpl library for EFT Bank File Creation with workaround for amounts 91dab2d3618b99b8758bf65d58cd8facc6df08ff gbg 2014-03-03 07:29:21
d2561 a3d2e47f82c1e0d9b245391d8e9cebec9a900afd gbg 2014-02-21 04:33:43
d2561 46df2f4ab87f400e7d20dfb31faf448d396f04fa gbg 2014-02-21 03:35:00
d2561 5614d485d8c4bcfd6402d6df9f1edbd4d8371305 gbg 2014-02-21 03:23:35
d2561 732b3761194e0c0783b9f31ae2df7541bdcd598f gbg 2014-02-21 01:12:15
d2561 b4b13a6ba9792b545ab63e8dfd600253e321c163 gbg 2014-02-21 00:51:11
d2561 df49e7e8ba5529218cb6c78a3bcaa11b6810830e gbg 2014-02-21 00:44:04
d2561 1ea4b24c354f3797da29ffba02870e0ff674a4d8 gbg 2014-02-21 00:28:48
d2561 377b24a944d64666775de8306b607fb8c9e524ae gbg 2014-02-21 00:00:44
d2561 ddcc8ed0c739b426768a8caf646260bfb008a1d9 gbg 2014-02-20 15:01:12
update 3cb83d589cf9081322366ee4eb38c0df910837f2 gbg 2013-12-20 08:35:41
Initial Load for Buderim Ginger e79fcfa36e7a9a80e19b84d121e99b53397dd5ba gbg 2013-12-18 03:24:58
Commit 5a7f22188dcae14b979985c75feebb47388be676 - c1485
Author: gbg
Author date (UTC): 2014-09-16 02:29
Committer name: gbg
Committer date (UTC): 2014-09-16 02:29
Parent(s): 2e7558f7db2b6e31da2519cad202b86da09adb9b
Signer:
Signing key:
Signing status: N
Tree: c50db1b6837834fde3af13e88e144f0522c78505
File Lines added Lines deleted
mfg/2013/base/src/QAD_CustProfitability.p 1254 0
mfg/2013/base/src/xfiv10u0.i 1 1
mfg/2013/base/src/xfiv10u5.i 0 0
mfg/2013/base/src/xfiv10ub.i 0 0
mfg/2013/base/src/xfiv10ue.i 0 0
mfg/2013/base/src/xfso10u5.i 0 0
mfg/2013/base/src/xfso10ub.i 0 0
mfg/2013/base/src/xfso10ue.i 0 0
File mfg/2013/base/src/QAD_CustProfitability.p added (mode: 100644) (index 0000000..8087662)
1 /* QAD_CustProfitability.p - Customer Profitability Report */
2 /* Reporting Framework */
3 /* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA. */
4 /* All rights reserved worldwide. This is an unpublished work. */
5 /*---------------------------------------------------------------------------*/
6 /* REVISION: 1.0 LAST MODIFIED: 20-MAY-2013 BY: gbg *c1407* */
7 /* REVISION: 1.0 LAST MODIFIED: 16-SEP-2014 BY: gbg *c1485* */
8 /*---------------------------------------------------------------------------*/
9 /* Report matches gltbrp.p for use by QAD Reporting Framework */
10 /*---------------------------------------------------------------------------*/
11
12 {mfsubdirs.i}
13 {us/bbi/mfdeclre.i}
14 {us/bbi/gplabel.i}
15 {us/bbi/gpfieldv.i}
16 {us/bbi/gpfilev.i}
17
18 {us/et/etvar.i &new="new"}
19 {us/et/etrpvar.i &new="new"}
20
21
22
23 {com/qad/shell/report/dsReportRequest.i}
24 {com/qad/shell/report/ReportConstants.i}
25
26 /*============================================================================*/
27 /* **************************** TEMP TABLES ******************************* */
28 /*============================================================================*/
29
30 /* TEMP-TABLE DEFINITION BLOCK */
31
32
33
34 define temp-table ttCustProfit no-undo
35 field InvDate as date
36 field InvBill as char
37 field SONumber as char
38 field InvoiceNumber as char
39 field InvCust as char
40 field InvLine as int
41 field LinePart as char
42 field InvProdLine as char
43 field InvPartDesc as char
44 field CustSort as char
45 field CustRegion as char
46 field DivCode as char
47 field LineGLCode as char
48 field CustGlobal as char
49 field CustSegment as char
50 field LineDisc as dec
51 field LineTerms as dec
52 field InvQty as dec
53 field LineCogs as dec
54 field LineList as dec
55 field Commission as dec
56 field InvFreight as dec
57 field InvDisc as dec
58 field InvTerms as dec
59 field RangeBeg as date
60 field RangeEnd as date
61 .
62
63 define temp-table ttReportOptions no-undo
64 /*
65 * field rptEnt as char
66 * field rptEnt1 as char
67 */
68 field rptDateBegin as char
69 field rptEndDate as char
70 /*
71 * field rptSummCC as logical
72 * field rptCurr as char
73 * field rptZeroFlag as logical
74 * field rpt1000 as logical
75 * field rptRound as logical
76 * field rptReportCurr as char
77 */
78 .
79
80
81 define dataset dsReportResults for ttCustProfit, ttReportOptions.
82
83 /* {gltrbl01.i NEW} */
84
85 define variable begyearper as integer format "999999".
86 define variable endyearper as integer format "999999".
87 define variable begdt as date.
88 define variable enddt as date.
89 define variable vdiscount as decimal.
90 define variable vterms as decimal.
91 define variable vfreight as decimal.
92 define variable vsegment as char.
93 define variable vregion as char.
94 define variable vglobal as char.
95 define variable vsort as char.
96 define variable vdesc as char.
97 define variable vcogs as decimal.
98 define variable vlist as decimal.
99 define variable vqtyinv as decimal.
100
101 /*============================================================================*/
102 /* ***************************** MAIN BLOCK ******************************* */
103 /*============================================================================*/
104 define input parameter runReport as logical no-undo.
105 define input parameter reportHandle as handle no-undo.
106 define input parameter dataset for dsReportRequest.
107 define output parameter dataset-handle phReportResults.
108
109 {com/qad/shell/report/reporting.i}
110 define variable bufferName as char no-undo.
111
112
113 /* empty temp-table tTrialBalance no-error. */
114
115
116 for first ttReportRequest no-lock:
117
118 run FillMetaData.
119
120 if runReport then do:
121 run RunReport
122 (output dataset-handle phReportResults).
123 end.
124
125 end.
126
127
128
129 /*============================================================================*/
130 /* ************************* Internal Procedures ************************** */
131 /*============================================================================*/
132 PROCEDURE FillMetaData:
133
134 buffername = "ttCustProfit".
135 run CreateBufferHeader in reportHandle
136 (buffername,
137 "Customer Profitability").
138
139 run CreateField in reportHandle
140 (buffername,
141 "InvDate",
142 "Invoice Date",
143 "date",
144 "99/99/99",
145 "",
146 false,
147 true,
148 true,
149 false,
150 false,
151 false,
152 false,
153 "",
154 {&ParameterOperator_Equals},
155 {&ParameterValueType_Constant},
156 "",
157 {&ParameterValueType_Constant}).
158
159 run CreateField in reportHandle
160 (buffername,
161 "InvBill",
162 "Bill To",
163 "character",
164 "x(8)",
165 "",
166 false,
167 true,
168 true,
169 false,
170 false,
171 false,
172 false,
173 "",
174 {&ParameterOperator_Equals},
175 {&ParameterValueType_Constant},
176 "",
177 {&ParameterValueType_Constant}).
178
179 run CreateField in reportHandle
180 (buffername,
181 "SONumber",
182 "SO Number",
183 "char",
184 "x(8)",
185 "",
186 false,
187 true,
188 true,
189 false,
190 false,
191 false,
192 false,
193 "",
194 {&ParameterOperator_Equals},
195 {&ParameterValueType_Constant},
196 "",
197 {&ParameterValueType_Constant}).
198
199 run CreateField in reportHandle
200 (buffername,
201 "InvoiceNumber",
202 "Inv",
203 "character",
204 "x(22)",
205 "",
206 false,
207 true,
208 true,
209 false,
210 false,
211 false,
212 false,
213 "",
214 {&ParameterOperator_Equals},
215 {&ParameterValueType_Constant},
216 "",
217 {&ParameterValueType_Constant}).
218
219 run CreateField in reportHandle
220 (buffername,
221 "InvCust",
222 "Cust",
223 "character",
224 "x(8)",
225 "",
226 false,
227 true,
228 true,
229 false,
230 false,
231 false,
232 false,
233 "",
234 {&ParameterOperator_Equals},
235 {&ParameterValueType_Constant},
236 "",
237 {&ParameterValueType_Constant}).
238
239 run CreateField in reportHandle
240 (buffername,
241 "InvLine",
242 "Line",
243 "int",
244 ">>9",
245 "",
246 false,
247 true,
248 true,
249 false,
250 false,
251 false,
252 false,
253 "",
254 {&ParameterOperator_Equals},
255 {&ParameterValueType_Constant},
256 "",
257 {&ParameterValueType_Constant}).
258
259 run CreateField in reportHandle
260 (buffername,
261 "InvLine",
262 "Line",
263 "int",
264 ">>9",
265 "",
266 false,
267 true,
268 true,
269 false,
270 false,
271 false,
272 false,
273 "",
274 {&ParameterOperator_Equals},
275 {&ParameterValueType_Constant},
276 "",
277 {&ParameterValueType_Constant}).
278
279 run CreateField in reportHandle
280 (buffername,
281 "LinePart",
282 "Part",
283 "char",
284 "x(18)",
285 "",
286 false,
287 true,
288 true,
289 false,
290 false,
291 false,
292 false,
293 "",
294 {&ParameterOperator_Equals},
295 {&ParameterValueType_Constant},
296 "",
297 {&ParameterValueType_Constant}).
298
299 run CreateField in reportHandle
300 (buffername,
301 "InvProdLine",
302 "ProdLine",
303 "char",
304 "x(4)",
305 "",
306 false,
307 true,
308 true,
309 false,
310 false,
311 false,
312 false,
313 "",
314 {&ParameterOperator_Equals},
315 {&ParameterValueType_Constant},
316 "",
317 {&ParameterValueType_Constant}).
318
319 run CreateField in reportHandle
320 (buffername,
321 "InvPartDesc",
322 "Description",
323 "char",
324 "x(24)",
325 "",
326 false,
327 true,
328 true,
329 false,
330 false,
331 false,
332 false,
333 "",
334 {&ParameterOperator_Equals},
335 {&ParameterValueType_Constant},
336 "",
337 {&ParameterValueType_Constant}).
338
339 run CreateField in reportHandle
340 (buffername,
341 "CustSort",
342 "Sort",
343 "char",
344 "x(28)",
345 "",
346 false,
347 true,
348 true,
349 false,
350 false,
351 false,
352 false,
353 "",
354 {&ParameterOperator_Equals},
355 {&ParameterValueType_Constant},
356 "",
357 {&ParameterValueType_Constant}).
358
359 run CreateField in reportHandle
360 (buffername,
361 "CustRegion",
362 "Region",
363 "char",
364 "x(4)",
365 "",
366 false,
367 true,
368 true,
369 false,
370 false,
371 false,
372 false,
373 "",
374 {&ParameterOperator_Equals},
375 {&ParameterValueType_Constant},
376 "",
377 {&ParameterValueType_Constant}).
378
379 run CreateField in reportHandle
380 (buffername,
381 "DivCode",
382 "Division",
383 "char",
384 "x(8)",
385 "",
386 false,
387 true,
388 true,
389 false,
390 false,
391 false,
392 false,
393 "",
394 {&ParameterOperator_Equals},
395 {&ParameterValueType_Constant},
396 "",
397 {&ParameterValueType_Constant}).
398
399 run CreateField in reportHandle
400 (buffername,
401 "LineGLCode",
402 "Account",
403 "char",
404 "x(8)",
405 "",
406 false,
407 true,
408 true,
409 false,
410 false,
411 false,
412 false,
413 "",
414 {&ParameterOperator_Equals},
415 {&ParameterValueType_Constant},
416 "",
417 {&ParameterValueType_Constant}).
418
419 run CreateField in reportHandle
420 (buffername,
421 "CustGlobal",
422 "Global",
423 "char",
424 "x(8)",
425 "",
426 false,
427 true,
428 true,
429 false,
430 false,
431 false,
432 false,
433 "",
434 {&ParameterOperator_Equals},
435 {&ParameterValueType_Constant},
436 "",
437 {&ParameterValueType_Constant}).
438
439 run CreateField in reportHandle
440 (buffername,
441 "CustSegment",
442 "Segment",
443 "char",
444 "x(2)",
445 "",
446 false,
447 true,
448 true,
449 false,
450 false,
451 false,
452 false,
453 "",
454 {&ParameterOperator_Equals},
455 {&ParameterValueType_Constant},
456 "",
457 {&ParameterValueType_Constant}).
458
459 run CreateField in reportHandle
460 (buffername,
461 "LineDisc",
462 "Discount",
463 "dec",
464 "->>>,>>>,>>9.99<<<",
465 "",
466 false,
467 true,
468 true,
469 false,
470 false,
471 false,
472 false,
473 "",
474 {&ParameterOperator_Equals},
475 {&ParameterValueType_Constant},
476 "",
477 {&ParameterValueType_Constant}).
478
479 run CreateField in reportHandle
480 (buffername,
481 "LineTerms",
482 "Terms",
483 "dec",
484 "->>>,>>>,>>9.99<<<",
485 "",
486 false,
487 true,
488 true,
489 false,
490 false,
491 false,
492 false,
493 "",
494 {&ParameterOperator_Equals},
495 {&ParameterValueType_Constant},
496 "",
497 {&ParameterValueType_Constant}).
498
499 run CreateField in reportHandle
500 (buffername,
501 "InvQty",
502 "Qty",
503 "dec",
504 "->>>,>>>,>>9.99<<<",
505 "",
506 false,
507 true,
508 true,
509 false,
510 false,
511 false,
512 false,
513 "",
514 {&ParameterOperator_Equals},
515 {&ParameterValueType_Constant},
516 "",
517 {&ParameterValueType_Constant}).
518
519
520 run CreateField in reportHandle
521 (buffername,
522 "LineCogs",
523 "Cogs",
524 "dec",
525 "->>>,>>>,>>9.99<<<",
526 "",
527 false,
528 true,
529 true,
530 false,
531 false,
532 false,
533 false,
534 "",
535 {&ParameterOperator_Equals},
536 {&ParameterValueType_Constant},
537 "",
538 {&ParameterValueType_Constant}).
539
540 run CreateField in reportHandle
541 (buffername,
542 "LineList",
543 "List",
544 "dec",
545 "->>>,>>>,>>9.99<<<",
546 "",
547 false,
548 true,
549 true,
550 false,
551 false,
552 false,
553 false,
554 "",
555 {&ParameterOperator_Equals},
556 {&ParameterValueType_Constant},
557 "",
558 {&ParameterValueType_Constant}).
559
560 run CreateField in reportHandle
561 (buffername,
562 "Commission",
563 "Commission",
564 "dec",
565 ">>9.9",
566 "",
567 false,
568 true,
569 true,
570 false,
571 false,
572 false,
573 false,
574 "",
575 {&ParameterOperator_Equals},
576 {&ParameterValueType_Constant},
577 "",
578 {&ParameterValueType_Constant}).
579
580 run CreateField in reportHandle
581 (buffername,
582 "InvFreight",
583 "Freight",
584 "dec",
585 "->>>,>>>,>>9.99<<<",
586 "",
587 false,
588 true,
589 true,
590 false,
591 false,
592 false,
593 false,
594 "",
595 {&ParameterOperator_Equals},
596 {&ParameterValueType_Constant},
597 "",
598 {&ParameterValueType_Constant}).
599
600 run CreateField in reportHandle
601 (buffername,
602 "InvDisc",
603 "Discount",
604 "dec",
605 "->>>,>>>,>>9.99<<<",
606 "",
607 false,
608 true,
609 true,
610 false,
611 false,
612 false,
613 false,
614 "",
615 {&ParameterOperator_Equals},
616 {&ParameterValueType_Constant},
617 "",
618 {&ParameterValueType_Constant}).
619
620 run CreateField in reportHandle
621 (buffername,
622 "InvTerms",
623 "Terms",
624 "dec",
625 "->>>,>>>,>>9.99<<<",
626 "",
627 false,
628 true,
629 true,
630 false,
631 false,
632 false,
633 false,
634 "",
635 {&ParameterOperator_Equals},
636 {&ParameterValueType_Constant},
637 "",
638 {&ParameterValueType_Constant}).
639
640 run CreateField in reportHandle
641 (buffername,
642 "RangeBeg",
643 "Begin Date",
644 "date",
645 "99/99/99",
646 "",
647 true,
648 true,
649 true,
650 false,
651 false,
652 false,
653 true,
654 "",
655 {&ParameterOperator_Equals},
656 {&ParameterValueType_Constant},
657 "",
658 {&ParameterValueType_Constant}).
659
660 run CreateField in reportHandle
661 (buffername,
662 "ReportEnd",
663 "End Date",
664 "date",
665 "99/99/99",
666 "",
667 true,
668 true,
669 true,
670 false,
671 false,
672 false,
673 true,
674 "",
675 {&ParameterOperator_Equals},
676 {&ParameterValueType_Constant},
677 "",
678 {&ParameterValueType_Constant}).
679
680
681 buffername = "ttReportOptions".
682 run CreateBufferHeader in reportHandle
683 (buffername,
684 "Report Options").
685
686 /*>>
687 run CreateField in reportHandle
688 (buffername,
689 "rptEnt",
690 "Entity From",
691 "character",
692 "x(4)",
693 "",
694 false,
695 true,
696 true,
697 false,
698 false,
699 false,
700 false,
701 "",
702 {&ParameterOperator_Equals},
703 {&ParameterValueType_Constant},
704 "",
705 {&ParameterValueType_Constant}).
706
707 run CreateField in reportHandle
708 (buffername,
709 "rptEnt1",
710 "Entity To",
711 "character",
712 "x(4)",
713 "",
714 false,
715 true,
716 true,
717 false,
718 false,
719 false,
720 false,
721 "",
722 {&ParameterOperator_Equals},
723 {&ParameterValueType_Constant},
724 "",
725 {&ParameterValueType_Constant}).
726 *<<*/
727
728 run CreateField in reportHandle
729 (buffername,
730 "rptDateBegin",
731 "Date from",
732 "date",
733 "99/99/99",
734 "",
735 true,
736 true,
737 true,
738 false,
739 false,
740 false,
741 true,
742 "",
743 {&ParameterOperator_Equals},
744 {&ParameterValueType_Constant},
745 "",
746 {&ParameterValueType_Constant}).
747
748 run CreateField in reportHandle
749 (buffername,
750 "rptDateEnd",
751 "Date to",
752 "date",
753 "99/99/99",
754 "",
755 true,
756 true,
757 true,
758 false,
759 false,
760 false,
761 true,
762 "",
763 {&ParameterOperator_Equals},
764 {&ParameterValueType_Constant},
765 "",
766 {&ParameterValueType_Constant}).
767
768 /*>>
769 run CreateField in reportHandle
770 (buffername,
771 "rptSummCC",
772 "Summ By CC",
773 "character",
774 "x(1)",
775 "",
776 false,
777 true,
778 true,
779 false,
780 false,
781 false,
782 false,
783 "",
784 {&ParameterOperator_Equals},
785 {&ParameterValueType_Constant},
786 "",
787 {&ParameterValueType_Constant}).
788
789 run CreateField in reportHandle
790 (buffername,
791 "rptCurr",
792 "Currency",
793 "character",
794 "x(3)",
795 "",
796 false,
797 true,
798 true,
799 false,
800 false,
801 false,
802 false,
803 "",
804 {&ParameterOperator_Equals},
805 {&ParameterValueType_Constant},
806 "",
807 {&ParameterValueType_Constant}).
808
809 run CreateField in reportHandle
810 (buffername,
811 "rptZeroFlag",
812 "Suppress Zero",
813 "character",
814 "x(1)",
815 "",
816 false,
817 true,
818 true,
819 false,
820 false,
821 false,
822 false,
823 "",
824 {&ParameterOperator_Equals},
825 {&ParameterValueType_Constant},
826 "",
827 {&ParameterValueType_Constant}).
828
829 run CreateField in reportHandle
830 (buffername,
831 "rpt1000",
832 "Round to Thousands",
833 "character",
834 "x(1)",
835 "",
836 false,
837 true,
838 true,
839 false,
840 false,
841 false,
842 false,
843 "",
844 {&ParameterOperator_Equals},
845 {&ParameterValueType_Constant},
846 "",
847 {&ParameterValueType_Constant}).
848
849 run CreateField in reportHandle
850 (buffername,
851 "rptRound",
852 "Round To Nearest Unit",
853 "character",
854 "x(1)",
855 "",
856 false,
857 true,
858 true,
859 false,
860 false,
861 false,
862 false,
863 "",
864 {&ParameterOperator_Equals},
865 {&ParameterValueType_Constant},
866 "",
867 {&ParameterValueType_Constant}).
868
869 run CreateField in reportHandle
870 (buffername,
871 "rptReportCurr",
872 "Reporting Currency",
873 "character",
874 "x(3)",
875 "",
876 false,
877 true,
878 true,
879 false,
880 false,
881 false,
882 false,
883 "",
884 {&ParameterOperator_Equals},
885 {&ParameterValueType_Constant},
886 "",
887 {&ParameterValueType_Constant}).
888 *<<*/
889
890
891 END. /* PROCEDURE FillMetaData */
892
893
894 /******************************************************************************/
895 PROCEDURE RunReport:
896 define output parameter dataset-handle phReportResults.
897
898 define var stringVar as char.
899
900
901 /* get Report Options from input */
902
903 /*>>
904 /* chars */
905 entity = GetFiltervalue("ttReportOptions", "rpEnt", "").
906 entity1 = GetFiltervalue("ttReportOptions", "rpEnt1", "").
907 rpt_curr = GetFiltervalue("ttReportOptions", "rptCurr", "").
908 et_report_curr = GetFiltervalue("ttReportOptions", "rptReportCurr", "").
909
910 /* logicals */
911 stringVar = getFilterValue("ttReportOptions", "rptSummCC", "n").
912 ccFlag = if stringVar begins "y" then true else false.
913 stringVar = getFilterValue("ttReportOptions", "rptZeroFlag", "n").
914 zeroflag = if stringVar begins "y" then true else false.
915 stringVar = getFilterValue("ttReportOptions", "rpt1000", "n").
916 prt1000 = if stringVar begins "y" then true else false.
917 stringVar = getFilterValue("ttReportOptions", "rptRound", "n").
918 round_cnts = if stringVar begins "y" then true else false.
919 *<<*/
920
921 /* dates */
922 stringVar = getFilterValue("ttReportOptions", "rptDateBegin", "").
923 begdt = date(stringVar) no-error.
924 stringVar = getFilterValue("ttReportOptions", "rptEndDate", "").
925 enddt = date(stringVar) no-error.
926
927 if begdt = ?
928 then do:
929 find last glc_cal no-lock
930 where glc_domain = global_domain
931 and glc_start <= today
932 no-error.
933 if available glc_cal
934 then do:
935 assign
936 begdt = glc_start
937 begyearper = int(string(glc_year,"9999") + string(glc_per,"99")).
938 end.
939 else do:
940 find last glc_cal no-lock
941 where glc_domain = global_domain
942 no-error.
943 if available glc_cal
944 then do:
945 assign
946 begdt = glc_start
947 begyearper = int(string(glc_year,"9999") + string(glc_per,"99")).
948 end.
949 end.
950 end.
951 if enddt = ?
952 then do:
953 find last glc_cal no-lock
954 where glc_domain = global_domain
955 and glc_start <= today
956 no-error.
957 if available glc_cal
958 then do:
959 assign
960 enddt = glc_end
961 endyearper = int(string(glc_year,"9999") + string(glc_per,"99")).
962 end.
963 else do:
964 find last glc_cal no-lock
965 where glc_domain = global_domain
966 no-error.
967 if available glc_cal
968 then do:
969 assign
970 enddt = glc_end
971 endyearper = int(string(glc_year,"9999") + string(glc_per,"99")).
972 end.
973 end.
974 end.
975
976
977 /*
978 if rpt_curr = "" then rpt_curr = base_curr.
979 if et_report_curr = "" then et_report_curr = rpt_curr.
980 */
981
982 /* initialise dates from calendar */
983
984 /*
985 find first glc_cal no-lock
986 where glc_domain = global_domain
987 and glc_start <= enddt
988 and glc_end >= begdt
989 no-error.
990 if available glc_cal
991 then do:
992 yr = glc_year.
993 begyearper = int(string(glc_year,"9999") + string(glc_per,"99")).
994 find first glc_cal no-lock
995 where glc_domain = global_domain
996 and glc_year = yr
997 and glc_per = 1
998 no-error.
999 if available glc_cal
1000 then do:
1001 assign
1002 yr_beg = glc_start.
1003 end.
1004 find last glc_cal no-lock
1005 where glc_domain = global_domain
1006 and glc_year = yr
1007 no-error.
1008 if available glc_cal
1009 then do:
1010 assign
1011 yr_end = glc_end
1012 end.
1013 end.
1014 */
1015 find first glc_cal no-lock
1016 where glc_domain = global_domain
1017 and glc_start >= begdt
1018 no-error.
1019 if available glc_cal
1020 then
1021 begyearper = int(string(glc_year,"9999") + string(glc_per,"99")).
1022
1023 find last glc_cal no-lock
1024 where glc_domain = global_domain
1025 and glc_end <= enddt
1026 no-error.
1027 if available glc_cal
1028 then
1029 endyearper = int(string(glc_year,"9999") + string(glc_per,"99")).
1030
1031
1032 /*>>
1033 /* Run the Trial Balance Report */
1034 {gprun.i ""gltrbl01.p""}
1035 *<<*/
1036
1037 for each ih_hist
1038 where ih_hist.ih_domain = global_domain
1039 and ih_inv_date >= begdt
1040 and ih_inv_date <= enddt
1041 no-lock
1042 break by ih_cust:
1043 for each idh_hist
1044 no-lock
1045 where idh_hist.idh_domain = global_domain
1046 and idh_inv_nbr = ih_inv_nbr
1047 and idh_nbr = ih_nbr
1048 break by idh_inv_nbr by idh_line
1049 with frame f width 80 no-attr-space:
1050
1051 /*>>
1052
1053 qty_open = idh_qty_ord - idh_qty_ship.
1054
1055 if ih_fsm_type = "FSM-RO"
1056 then
1057 run check_for_callinvoice
1058 (input idh_nbr,
1059 input idh_line,
1060 input idh_part).
1061 *<<*/
1062
1063 find cm_mstr where
1064 cm_domain = global_domain and
1065 cm_addr = ih_cust
1066 no-lock no-error.
1067 if available cm_mstr then do:
1068 assign vsort = cm_sort
1069 vglobal = if cm_type begins "AU" then "Domestic" else "Export"
1070 vsegment = substring(cm_type,1,2)
1071 vregion = cm_region.
1072 end.
1073 find pt_mstr where
1074 pt_domain = global_domain and
1075 pt_part = idh_part
1076 no-lock no-error.
1077 if available pt_mstr then
1078 vdesc = pt_desc1.
1079 else
1080 vdesc = idh_desc.
1081
1082 assign vterms = 0
1083 vlist = 0
1084 vcogs = 0
1085 vqtyinv = idh_qty_inv
1086 vdiscount = 0.
1087
1088 for each iph_hist where
1089 iph_domain = global_domain and
1090 iph_inv_nbr = idh_inv_nbr and
1091 iph_nbr = ih_nbr and
1092 iph_line = idh_line
1093 no-lock:
1094 if iph_disc_acct = "41740" then
1095 vdiscount = vdiscount + iph_disc_amt * vqtyinv.
1096 if iph_disc_acct = "41760" then
1097 vdiscount = vdiscount + iph_disc_amt * vqtyinv.
1098 if iph_disc_acct = "41710" then
1099 vterms = vterms + iph_disc_amt * vqtyinv.
1100 if iph_disc_acct = "41720" then
1101 vterms = vterms + iph_disc_amt * vqtyinv.
1102 if iph_disc_acct = "41730" then
1103 vterms = vterms + iph_disc_amt * vqtyinv.
1104 if iph_disc_acct = "41750" then
1105 vterms = vterms + iph_disc_amt * vqtyinv.
1106 if iph_amt_type = "1" then
1107 vlist = vlist + iph_amt * vqtyinv.
1108 if iph_amt_type = "1" then
1109 vcogs = vcogs + idh_std_cost * vqtyinv.
1110 end.
1111
1112 display
1113 ih_inv_date
1114 ih_bill
1115 idh_nbr
1116 idh_inv_nbr
1117 ih_cust
1118 idh_part
1119 idh_prodline
1120 vdesc
1121 vsort
1122 vregion
1123 vglobal
1124 vsegment
1125 idh_line
1126 idh_qty_inv
1127 .
1128 /*
1129 idh_site
1130 idh_qty_inv when (ih_fsm_type <> "FSM-RO")
1131 l_qty_call when (ih_fsm_type = "FSM-RO") @ idh_qty_inv
1132 qty_open when (ih_fsm_type <> "FSM-RO")
1133 l_idh_bo_chg when (ih_fsm_type = "FSM-RO") @ qty_open.
1134 */
1135 create ttCustProfit.
1136 assign
1137 ttCustProfit.InvDate = ih_inv_date
1138 ttCustProfit.Invbill = ih_bill
1139 ttCustProfit.SoNumber = ih_nbr
1140 ttCustProfit.InvoiceNumber = ih_inv_nbr
1141 ttCustProfit.InvCust = ih_cust
1142 ttCustProfit.InvLine = idh_line
1143 ttCustProfit.LinePart = idh_part
1144 ttCustProfit.InvProdLine = idh_prodline
1145 ttCustProfit.InvPartDesc = vdesc
1146 ttCustProfit.CustSort = vsort
1147 ttCustProfit.CustRegion = vregion
1148 ttCustProfit.CustGlobal = vglobal
1149 ttCustProfit.CustSegment = vsegment
1150 ttCustProfit.LineDisc = vdiscount
1151 ttCustProfit.LineTerms = vterms
1152 ttCustProfit.InvQty = idh_qty_inv
1153 ttCustProfit.LineCogs = vcogs
1154 ttCustProfit.LineList = vlist
1155 ttCustProfit.RangeBeg = begdt
1156 ttCustProfit.RangeEnd = enddt
1157 .
1158
1159 if last-of(ih_cust) then do:
1160 vfreight = 0.
1161 vdiscount = 0.
1162 vterms = 0.
1163 find first Domains where
1164 Domains.DomainCode = global_domain
1165 no-lock no-error.
1166 if available Domains then do:
1167 find first Company where
1168 Company.Company_ID = PrimaryCompany_ID
1169 no-lock no-error.
1170 if available Company then do:
1171 for each GL where
1172 lookup(GLCode, "41745,41765,41725,41735,41755") > 0
1173 no-lock:
1174 for each PostingLine where
1175 PostingLine.GL_ID = GL.GL_ID
1176 and PostingYearPeriod >= begyearper
1177 and PostingYearPeriod <= endyearper
1178 and can-find(first Division where
1179 Division.Division_ID = PostingLine.Division_ID and
1180 DivisionCode = ih_cust)
1181 no-lock:
1182 /*
1183 display
1184 GL.GLCode
1185 (PostingLineCreditTC + PostingLineDebitTC).
1186 */
1187
1188 create ttCustProfit.
1189 assign
1190 ttCustProfit.InvDate = ih_inv_date
1191 ttCustProfit.Invbill = ih_bill
1192 ttCustProfit.SoNumber = ih_nbr
1193 ttCustProfit.InvoiceNumber = ih_inv_nbr
1194 ttCustProfit.InvCust = ih_cust
1195 ttCustProfit.CustSort = vsort
1196 ttCustProfit.CustRegion = vregion
1197 ttCustProfit.CustGlobal = vglobal
1198 ttCustProfit.CustSegment = vsegment
1199 ttCustProfit.DivCode = DivisionCode
1200 ttCustProfit.LineGLCode = GL.GLCode
1201 .
1202 if lookup(GL.GLCode,"41745,41765") > 0
1203 then
1204 ttCustProfit.InvDisc =
1205 (PostingLineCreditTC + PostingLineDebitTC).
1206 else
1207 ttCustProfit.InvTerms =
1208 (PostingLineCreditTC + PostingLineDebitTC).
1209 end.
1210 end.
1211 end.
1212 end.
1213 end.
1214 if last-of(idh_inv_nbr) then do:
1215 if ih_trl1_cd <> "10" then
1216 vfreight = ih_trl1_amt.
1217 else if ih_trl2_cd <> "10" then
1218 vfreight = ih_trl2_amt.
1219 else if ih_trl3_cd <> "10" then
1220 vfreight = ih_trl3_amt.
1221 /*gbg*/ if vfreight <> 0
1222 /*gbg*/ then do:
1223 create ttCustProfit.
1224 assign
1225 ttCustProfit.InvDate = ih_inv_date
1226 ttCustProfit.Invbill = ih_bill
1227 ttCustProfit.SoNumber = ih_nbr
1228 ttCustProfit.InvoiceNumber = ih_inv_nbr
1229 ttCustProfit.InvCust = ih_cust
1230 ttCustProfit.CustSort = vsort
1231 ttCustProfit.CustRegion = vregion
1232 ttCustProfit.CustGlobal = vglobal
1233 ttCustProfit.CustSegment = vsegment
1234 ttCustProfit.DivCode = DivisionCode
1235 ttCustProfit.LineGLCode = GL.GLCode
1236 ttCustProfit.InvFreight = vfreight
1237 .
1238 /*gbg*/ end.
1239 end.
1240 end.
1241 end.
1242
1243 /*
1244 /* Copy the data to the Result Dataset */
1245 for each tTrialBalance:
1246 create ttCustProfit.
1247 buffer-copy tTrialBalance to ttTrialBalance.
1248 end.
1249 */
1250
1251 phReportResults = dataset dsReportResults:handle.
1252
1253
1254 END. /* Procedure runreport */
File mfg/2013/base/src/xfiv10u0.i changed (mode: 100644) (index a1a52d3..fb795fb)
94 94
95 95 /*k2155* start added code >>> */ /*k2155* start added code >>> */
96 96 for first Debtor no-lock for first Debtor no-lock
97 where Debtor.DebtorCode = so_cust,
97 where Debtor.DebtorCode = ih_cust,
98 98 first BusinessRelation of Debtor no-lock, first BusinessRelation of Debtor no-lock,
99 99 each Address no-lock each Address no-lock
100 100 where Address.BusinessRelation_ID = where Address.BusinessRelation_ID =
File mfg/2013/base/src/xfiv10u5.i changed (mode: 100644) (index bb67cde..71880ee)
File mfg/2013/base/src/xfiv10ub.i changed (mode: 100644) (index 832eb0a..a5d63a0)
File mfg/2013/base/src/xfiv10ue.i changed (mode: 100644) (index 832eb0a..bd3950d)
File mfg/2013/base/src/xfso10u5.i changed (mode: 100644) (index 678336d..d9eee6e)
File mfg/2013/base/src/xfso10ub.i changed (mode: 100644) (index 561c5a3..0028f50)
File mfg/2013/base/src/xfso10ue.i changed (mode: 100644) (index 832eb0a..8dad1ff)
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/gbfg55/gbg-20-git

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/gbfg55/gbg-20-git

Clone this repository using git:
git clone git://git.rocketgit.com/user/gbfg55/gbg-20-git

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main