shareneus 1.7.4 → 1.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/accounting/invoice/invoice-pdf/invoice-pdf.service.js +18 -45
- package/dist/accounting/invoice/reports/excel/analysis-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/category-wise-item-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/cust-wise-sales-details.js +17 -7
- package/dist/accounting/invoice/reports/excel/cust-wise-sales-summary-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/invoice-wise-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/item-wise-doctor-sale-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/items-wise-sales-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/manf-wise-sales-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/operator-wise-details.js +17 -7
- package/dist/accounting/invoice/reports/excel/operator-wise-summary.js +17 -7
- package/dist/accounting/invoice/reports/excel/sa-wise-labor-sales-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/sa-wise-part-sales-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/sale-summary-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/sales-by-service-summary-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/scheduled-drug-summary-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/scheduled-drugs-excel.service.js +17 -7
- package/dist/accounting/invoice/unified-invoice-pdf.service.d.ts +1 -1
- package/dist/accounting/payment-receive/reports/excel/cust-balance-excel.service.js +17 -7
- package/dist/accounting/payment-receive/reports/excel/payment-receive-excel.service.js +17 -7
- package/dist/common/reports/excel/product-without-owner-excel.service.js +17 -7
- package/dist/gst/excel/GSTR-RO-excel.service.js +17 -7
- package/dist/gst/excel/GSTR1-excel.service.js +17 -7
- package/dist/gst/excel/GSTR2-excel.service.js +17 -7
- package/dist/gst/excel/hsn-summary.js +17 -7
- package/dist/gst/excel/tally-sales-import.service.js +17 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/inventory/items/reports/excel/expiring-drugs-excel.service.js +17 -7
- package/dist/inventory/items/reports/excel/item-wise-mout-details.js +17 -7
- package/dist/inventory/items/reports/excel/item-wise-mout-summary.js +17 -7
- package/dist/inventory/items/reports/excel/spares-issue-excel.service.js +17 -7
- package/dist/inventory/items/reports/excel/stock-excel.service.js +17 -7
- package/dist/purchases/payment-made/reports/excel/payments-made-excel.service.js +17 -7
- package/dist/purchases/payment-made/reports/excel/ven-balance-excel.service.js +17 -7
- package/dist/services/reports/excel/insurance-expire-excel.service.js +17 -7
- package/dist/services/reports/excel/next-service-date-excel.service.js +17 -7
- package/dist/services/reports/excel/repair-orders-excel.service.js +17 -7
- package/dist/shared/table-section/pdf-table.header.d.ts +1 -1
- package/dist/shared/table-section/pdf-table.header.js +14 -2
- package/dist/shared/table-section/pdf-table.section.js +6 -13
- package/dist/{accounting/invoice/invoice-pdf.service.js → shared/transactions-pdf.service.js} +15 -15
- package/package.json +1 -1
- package/src/accounting/counter-sales/auto-sales-receipt-pdf.service.ts +569 -0
- package/src/accounting/counter-sales/pos-receipt-pdf.ts +577 -0
- package/src/accounting/counter-sales/sales-receipt-pdf.service.ts +628 -0
- package/src/accounting/counter-sales/sales-receipt-print.service.ts +506 -0
- package/src/accounting/credit-note/cn-print.service.ts +264 -0
- package/src/accounting/credit-note/credit-note-pdf.service.ts +602 -0
- package/src/accounting/credit-note/credit-note-totals.service.ts +424 -0
- package/src/accounting/debit-note/debit-note-pdf.service.ts +681 -0
- package/src/accounting/debit-note/debit-note-print.service.ts +276 -0
- package/src/accounting/debit-note/debit-note-totals.service.ts +361 -0
- package/src/accounting/invoice/hc-inv-pdf.service.ts +880 -0
- package/src/accounting/invoice/inv-pdf.service.ts +812 -0
- package/src/accounting/invoice/inv-print.service.ts +532 -0
- package/src/accounting/invoice/invoice-landscape-pdf.service.ts +947 -0
- package/src/accounting/invoice/invoice-letterhead-pdf.service.ts +813 -0
- package/src/accounting/invoice/invoice-pdf/invoice-pdf.service.ts +359 -0
- package/src/accounting/invoice/invoice-portrait-pdf.ts +972 -0
- package/src/accounting/invoice/invoice-print.service.ts +2906 -0
- package/src/accounting/invoice/invoice-total.service.ts +834 -0
- package/src/accounting/invoice/reports/excel/analysis-excel.service.ts +291 -0
- package/src/accounting/invoice/reports/excel/category-wise-item-excel.service.ts +267 -0
- package/src/accounting/invoice/reports/excel/cust-wise-sales-details.ts +321 -0
- package/src/accounting/invoice/reports/excel/cust-wise-sales-summary-excel.service.ts +300 -0
- package/src/accounting/invoice/reports/excel/invoice-wise-excel.service.ts +859 -0
- package/src/accounting/invoice/reports/excel/item-wise-doctor-sale-excel.service.ts +255 -0
- package/src/accounting/invoice/reports/excel/items-wise-sales-excel.service.ts +312 -0
- package/src/accounting/invoice/reports/excel/manf-wise-sales-excel.service.ts +273 -0
- package/src/accounting/invoice/reports/excel/operator-wise-details.ts +258 -0
- package/src/accounting/invoice/reports/excel/operator-wise-summary.ts +259 -0
- package/src/accounting/invoice/reports/excel/sa-wise-labor-sales-excel.service.ts +230 -0
- package/src/accounting/invoice/reports/excel/sa-wise-part-sales-excel.service.ts +231 -0
- package/src/accounting/invoice/reports/excel/sale-summary-excel.service.ts +326 -0
- package/src/accounting/invoice/reports/excel/sales-by-service-details-excel.service.ts +0 -0
- package/src/accounting/invoice/reports/excel/sales-by-service-summary-excel.service.ts +432 -0
- package/src/accounting/invoice/reports/excel/scheduled-drug-summary-excel.service.ts +373 -0
- package/src/accounting/invoice/reports/excel/scheduled-drugs-excel.service.ts +372 -0
- package/src/accounting/invoice/reports/pdf/analysis-pdf.service.ts +113 -0
- package/src/accounting/invoice/reports/pdf/category-wise-item-pdf.service.ts +107 -0
- package/src/accounting/invoice/reports/pdf/cust-wise-sales-details-pdf.service.ts +125 -0
- package/src/accounting/invoice/reports/pdf/cust-wise-sales-summary-pdf.service.ts +119 -0
- package/src/accounting/invoice/reports/pdf/item-wise-doctor-sale-pdf.service.ts +180 -0
- package/src/accounting/invoice/reports/pdf/item-wise-sales-pdf.service.ts +193 -0
- package/src/accounting/invoice/reports/pdf/manf-wise-sales-pdf.service.ts +188 -0
- package/src/accounting/invoice/reports/pdf/operator-wise-details-pdf.service.ts +118 -0
- package/src/accounting/invoice/reports/pdf/operator-wise-summary-pdf.ts +116 -0
- package/src/accounting/invoice/reports/pdf/sales-by-service-pdf.service.ts +132 -0
- package/src/accounting/invoice/reports/pdf/scheduled-drug-pdf.service.ts +191 -0
- package/src/accounting/invoice/reports/pdf/scheduled-drug-summary-pdf.service.ts +202 -0
- package/src/accounting/invoice/shared-inv-pdf.service.ts +787 -0
- package/src/accounting/invoice/unified-invoice-pdf.service.ts +937 -0
- package/src/accounting/payment-receive/payment-pdf.service.ts +410 -0
- package/src/accounting/payment-receive/payment-receipt-pdf/receipt-pdf.service.ts +470 -0
- package/src/accounting/payment-receive/receipt-print.service.ts +71 -0
- package/src/accounting/payment-receive/reports/excel/cust-balance-excel.service.ts +298 -0
- package/src/accounting/payment-receive/reports/excel/payment-receive-excel.service.ts +221 -0
- package/src/accounting/payment-receive/reports/pdf/customer-balances-pdf.service.ts +182 -0
- package/src/accounting/payment-receive/reports/pdf/payment-report-pdf.service.ts +116 -0
- package/src/aggregation/aggregation.ts +58 -0
- package/src/appointments/appointments/appointment-total.service.ts +298 -0
- package/src/appointments/consultations/consultation-fee-receipt.service.ts +407 -0
- package/src/appointments/consultations/consultation-full-pdf.service.ts +238 -0
- package/src/appointments/consultations/consultation-letterhead-pdf.service.ts +430 -0
- package/src/appointments/consultations/consultation-pdf.service.ts +417 -0
- package/src/common/reports/excel/product-without-owner-excel.service.ts +308 -0
- package/src/common/reports/pdf/product-without-owner-pdf.service.ts +146 -0
- package/src/enums/cache-enums.ts +33 -0
- package/src/enums/code-enums.ts +291 -0
- package/src/enums/country-enums.ts +9 -0
- package/src/enums/enums.ts +364 -0
- package/src/enums/industry-enums.ts +26 -0
- package/src/enums/treatment-enums.ts +9 -0
- package/src/gst/excel/GSTR-RO-excel.service.ts +926 -0
- package/src/gst/excel/GSTR1-excel.service.ts +313 -0
- package/src/gst/excel/GSTR2-excel.service.ts +314 -0
- package/src/gst/excel/hsn-summary.ts +314 -0
- package/src/gst/excel/tally-sales-import.service.ts +767 -0
- package/src/gst/pdf/hsn-summary-pdf.ts +176 -0
- package/src/index.ts +194 -0
- package/src/inventory/items/adjustment-pdf.service.ts +177 -0
- package/src/inventory/items/issue-parts-pdf.service.ts +795 -0
- package/src/inventory/items/item-bar-code-label-pdf.ts +194 -0
- package/src/inventory/items/item-detais-pdf.ts +141 -0
- package/src/inventory/items/item-price-for-pricelist.ts +368 -0
- package/src/inventory/items/reports/excel/expiring-drugs-excel.service.ts +290 -0
- package/src/inventory/items/reports/excel/item-wise-mout-details.ts +284 -0
- package/src/inventory/items/reports/excel/item-wise-mout-summary.ts +279 -0
- package/src/inventory/items/reports/excel/spares-issue-excel.service.ts +494 -0
- package/src/inventory/items/reports/excel/stock-excel.service.ts +319 -0
- package/src/inventory/items/reports/pdf/expiring-drugs-pdf.service.ts +172 -0
- package/src/inventory/items/reports/pdf/item-wise-mout-details-pdf.ts +122 -0
- package/src/inventory/items/reports/pdf/item-wise-mout-summary-pdf.ts +115 -0
- package/src/inventory/items/reports/pdf/reorder-point-pdf.service.ts +163 -0
- package/src/inventory/material-out/mout-pdf.service.ts +545 -0
- package/src/inventory/transfer-order/transfer-order-pdf.service.ts +154 -0
- package/src/purchases/bills/bill-pdf/bill-pdf.service.ts +211 -0
- package/src/purchases/bills/bill-pdf.service.ts +21 -0
- package/src/purchases/payment-made/reports/excel/payments-made-excel.service.ts +313 -0
- package/src/purchases/payment-made/reports/excel/ven-balance-excel.service.ts +307 -0
- package/src/purchases/payment-made/reports/pdf/vendor-balances-pdf.service.ts +114 -0
- package/src/purchases/purchase-order/po-totals.service.ts +343 -0
- package/src/purchases/purchase-order/purchase-order-pdf.service.ts +1016 -0
- package/src/purchases/purchase-order/purchase-order-print.service.ts +279 -0
- package/src/purchases/purchase-order/purchase-order-totals.service.ts +637 -0
- package/src/purchases/vendor-credit-note/vendor-credit-note-pdf.service.ts +1055 -0
- package/src/purchases/vendor-credit-note/vendor-credit-note-print.service.ts +145 -0
- package/src/purchases/vendor-credit-note/vendor-credit-note-totals.service.ts +399 -0
- package/src/purchases/vendor-debit-note/vendor-debit-note-pdf.service.ts +582 -0
- package/src/purchases/vendor-debit-note/vendor-debit-note-print.service.ts +295 -0
- package/src/purchases/vendor-debit-note/vendor-debit-note-totals.service.ts +377 -0
- package/src/sales/delivery-challan/dc-landscape-pdf.service.ts +922 -0
- package/src/sales/delivery-challan/dc-landscape-without-price-pdf.service.ts +869 -0
- package/src/sales/delivery-challan/dc-without-price-pdf.service.ts +505 -0
- package/src/sales/delivery-challan/delivery-challan-pdf.service.ts +461 -0
- package/src/sales/delivery-challan/delivery-challan-print.service.ts +229 -0
- package/src/sales/delivery-challan/delivery-challan-totals.ts +466 -0
- package/src/sales/sales/equipment-design-pdf.service.ts +153 -0
- package/src/sales/sales/pack-ship-pdf.service.ts +128 -0
- package/src/sales/sales/pack-ship-print.service.ts +198 -0
- package/src/sales/sales/sales-pdf.service.ts +658 -0
- package/src/sales/sales/sales-print.service.ts +376 -0
- package/src/sales/sales/sales-totals.service.ts +500 -0
- package/src/sales-receive/sales-receive-pdf.service.ts +602 -0
- package/src/sales-receive/sales-receive-print.service.ts +242 -0
- package/src/sales-receive/sales-receive-totals.service.ts +651 -0
- package/src/services/checklist-pdf.ts +151 -0
- package/src/services/checklists-pdf.ts +133 -0
- package/src/services/est.print-service.ts +1155 -0
- package/src/services/reports/excel/insurance-expire-excel.service.ts +292 -0
- package/src/services/reports/excel/next-service-date-excel.service.ts +317 -0
- package/src/services/reports/excel/repair-orders-excel.service.ts +249 -0
- package/src/services/reports/pdf/insurance-expire-pdf.service.ts +115 -0
- package/src/services/reports/pdf/next-service-date-pdf.service.ts +198 -0
- package/src/services/reports/pdf/repair-orders-pdf.service.ts +184 -0
- package/src/services/ro-pdf.service.ts +1917 -0
- package/src/services/ro-print-service.ts +881 -0
- package/src/services/ro-totals.service.ts +1314 -0
- package/src/services/separate-wo-print.service.ts +396 -0
- package/src/services/service-history-pdf.service.ts +145 -0
- package/src/services/service-price-for-pricelist.ts +649 -0
- package/src/services/technician-pdf.service.ts +234 -0
- package/src/services/technician-print.service.ts +95 -0
- package/src/shared/header-footer-section/pdf-header-footer.section.ts +519 -0
- package/src/shared/header-footer-section/pdf-shared.utils.ts +46 -0
- package/src/shared/math-operations.ts +208 -0
- package/src/shared/party-details-section/pdf-party-details.section.ts +602 -0
- package/src/shared/shared-pdf.service.ts +3042 -0
- package/src/shared/shared-print.service.ts +879 -0
- package/src/shared/table-section/pdf-table.config.ts +8 -0
- package/src/shared/table-section/pdf-table.header.ts +396 -0
- package/src/shared/table-section/pdf-table.row.ts +248 -0
- package/src/shared/table-section/pdf-table.section.ts +447 -0
- package/src/shared/totals-section/pdf-totals.section.ts +921 -0
- package/src/shared/transactions-pdf.service.ts +191 -0
- package/src/shared/util.ts +101 -0
- package/src/tasks/meetings/meeting-pdf.ts +410 -0
- package/src/tasks/tasks/task-pdf.service.ts +238 -0
- package/src/tasks/tasks/task-reports-pdf.service.ts +313 -0
- package/src/tax/index.ts +86 -0
- package/src/tax/tax-calculator.ts +1025 -0
- package/src/tax/tax.types.ts +535 -0
- package/src/transaction-calculations/discounts-distribution.ts +343 -0
- package/src/transaction-calculations/index.ts +3 -0
- package/src/transaction-calculations/total-calculation.ts +443 -0
- package/src/transaction-calculations/transaction-calculation-engine.ts +903 -0
- package/src/utils/my-date.ts +111 -0
- package/src/utils/tr-utils.ts +104 -0
- package/tsconfig.json +2 -2
- /package/dist/{accounting/invoice/invoice-pdf.service.d.ts → shared/transactions-pdf.service.d.ts} +0 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { ROTypeEnum } from '../../enums/code-enums';
|
|
2
|
+
import { InvoiceStatusEnum, PayTypeEnum } from '../../enums/enums';
|
|
3
|
+
import { Add, Divide, Subtract } from '../../shared/math-operations';
|
|
4
|
+
import { PrintSharedService } from '../../shared/shared-print.service';
|
|
5
|
+
import { MyDate } from '../../utils/my-date';
|
|
6
|
+
import { TrUtils } from '../../utils/tr-utils';
|
|
7
|
+
import { CreditNoteTotalsService } from './credit-note-totals.service';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export class CNPrintService {
|
|
11
|
+
|
|
12
|
+
static GetCreditNotePrintInfo(OriginalInvoiceData: any, OriginalEntityData: any, image: any,
|
|
13
|
+
IncludeGST: boolean, ConsolidateGST: boolean, TaxCodes: any, IsProforma: boolean) {
|
|
14
|
+
|
|
15
|
+
let ForInsurance: boolean = !TrUtils.IsNull(OriginalInvoiceData.BillTo.InsId);
|
|
16
|
+
let InvoicePrintData: any = {};
|
|
17
|
+
let argInvoiceData = TrUtils.Stringify(OriginalInvoiceData);
|
|
18
|
+
if (!IncludeGST) {
|
|
19
|
+
argInvoiceData.Settings.Tax = 'NO';
|
|
20
|
+
}
|
|
21
|
+
InvoicePrintData.IsProforma = IsProforma;
|
|
22
|
+
InvoicePrintData.Settings = TrUtils.Stringify(argInvoiceData.Settings);
|
|
23
|
+
InvoicePrintData.SType = TrUtils.Stringify(argInvoiceData.SType);
|
|
24
|
+
|
|
25
|
+
let SType: any = TrUtils.IsNull(argInvoiceData.SType) ? null : argInvoiceData.SType;
|
|
26
|
+
InvoicePrintData = this.GetPrintConditionsBasedOnInput(InvoicePrintData, IncludeGST, ConsolidateGST, ForInsurance,
|
|
27
|
+
SType, argInvoiceData, IsProforma);
|
|
28
|
+
InvoicePrintData.Entity = PrintSharedService.GetFormattedEntityDataForPrint(OriginalEntityData, "Invoice", OriginalInvoiceData);
|
|
29
|
+
InvoicePrintData = PrintSharedService.GetEntityHeaderStyles(InvoicePrintData, OriginalEntityData, image);
|
|
30
|
+
InvoicePrintData = this.GetInvoiceOtherDetailsForPrint(InvoicePrintData, argInvoiceData);
|
|
31
|
+
let IsTaxable: boolean = (IncludeGST && TrUtils.isTaxable(argInvoiceData.Settings.Tax)) ? true : false;
|
|
32
|
+
let finalTotalsData: any = CreditNoteTotalsService.GetTotalsValue([], argInvoiceData.Items, IsTaxable,
|
|
33
|
+
true,
|
|
34
|
+
argInvoiceData.Disc, argInvoiceData.Perc, TaxCodes, true, argInvoiceData.Settings, InvoicePrintData.Entity);
|
|
35
|
+
if (ConsolidateGST) {
|
|
36
|
+
finalTotalsData.CustLaborTotalBeforeDisc = finalTotalsData.CustLaborAfterTax;
|
|
37
|
+
finalTotalsData.CustPartsTotalBeforeDisc = finalTotalsData.CustPartAfterTax;
|
|
38
|
+
}
|
|
39
|
+
InvoicePrintData = TrUtils.ConcatObjects(InvoicePrintData, finalTotalsData);
|
|
40
|
+
InvoicePrintData.Items = this.GetItemsPrintInfo(InvoicePrintData.Items, ConsolidateGST, TaxCodes,
|
|
41
|
+
OriginalEntityData.Entity.Settings?.Acc?.LTot, InvoicePrintData.Entity.DecimalsNumber);
|
|
42
|
+
argInvoiceData = this.ReverseItemsForInvoicePrint(argInvoiceData);
|
|
43
|
+
InvoicePrintData.PrintInfo = this.PrepareFormatForInvoicePrint(InvoicePrintData, ROTypeEnum.Invoice, argInvoiceData.Sts);
|
|
44
|
+
InvoicePrintData = this.GetFormattedProductDataForPrint(argInvoiceData, InvoicePrintData);
|
|
45
|
+
InvoicePrintData = this.GetBillNameForInvoicePrint(argInvoiceData, InvoicePrintData);
|
|
46
|
+
InvoicePrintData.Consolidate = ConsolidateGST;
|
|
47
|
+
return InvoicePrintData;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static GetPrintConditionsBasedOnInput(InvoicePrintData: any, IncludeGST: boolean, ConsolidateGST: boolean,
|
|
51
|
+
ForInsurance: boolean, SType: any, OriginalInvoiceData: any, IsProforma: boolean) {
|
|
52
|
+
|
|
53
|
+
InvoicePrintData.ForInsurance = ForInsurance;
|
|
54
|
+
InvoicePrintData.For = ForInsurance ? PayTypeEnum.Insurance : PayTypeEnum.Customer;
|
|
55
|
+
InvoicePrintData.IncludeGST = IncludeGST;
|
|
56
|
+
InvoicePrintData.ConsolidateGST = ConsolidateGST;
|
|
57
|
+
InvoicePrintData.ShowAccParts = false;
|
|
58
|
+
InvoicePrintData.ShowIGST = (TrUtils.IsNull(SType) || (SType === 'Intra')) ? false : true;
|
|
59
|
+
InvoicePrintData.ShowTaxColumn = (IncludeGST && !ConsolidateGST) ? true : false;
|
|
60
|
+
// InvoicePrintData.ShowDiscountColumn = (!ForInsurance && !ConsolidateGST) ? true : false;
|
|
61
|
+
InvoicePrintData = this.GetInvoiceTypeHeading(InvoicePrintData, OriginalInvoiceData, IncludeGST, ConsolidateGST, IsProforma);
|
|
62
|
+
InvoicePrintData.PrDate = TrUtils.IsNull(OriginalInvoiceData.PrDate) ? '' : MyDate.ConvertUTCDateToReadable(OriginalInvoiceData.PrDate);
|
|
63
|
+
return InvoicePrintData;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static GetInvoiceTypeHeading(InvoicePrintData: any, OriginalInvoiceData: any, IncludeGST: boolean,
|
|
67
|
+
ConsolidateGST: boolean, IsProforma: boolean) {
|
|
68
|
+
InvoicePrintData.HeaderName = 'Credit Notes';
|
|
69
|
+
return InvoicePrintData;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
static GetInvoiceOtherDetailsForPrint(InvoicePrintData: any, OriginalInvoiceData: any) {
|
|
73
|
+
InvoicePrintData.Type = 'Credit Notes';
|
|
74
|
+
InvoicePrintData._id = OriginalInvoiceData.Code;
|
|
75
|
+
InvoicePrintData.Sts = OriginalInvoiceData.Sts;
|
|
76
|
+
InvoicePrintData.CrDate = MyDate.ConvertUTCDateToReadable(OriginalInvoiceData.CrDate);
|
|
77
|
+
return InvoicePrintData;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static GetItemsPrintInfo(Items: any, Consolidate: boolean, TaxCodes: any, LineTotal: string, DecimalsNumber: number) {
|
|
81
|
+
Items.forEach((Item: any) => {
|
|
82
|
+
Item.TCode = this.GetTCodeFromTaxes(Item);
|
|
83
|
+
const cgstAmount = this.GetTaxAmountFromTaxes(Item, 'CGST', Item.CGST);
|
|
84
|
+
const sgstAmount = this.GetTaxAmountFromTaxes(Item, 'SGST', Item.SGST);
|
|
85
|
+
const igstAmount = this.GetTaxAmountFromTaxes(Item, 'IGST', Item.IGST);
|
|
86
|
+
|
|
87
|
+
if (Consolidate) {
|
|
88
|
+
let AfterDiscForEach = Divide(Item.AfterPartDisc, Item.Qty);
|
|
89
|
+
let CTaxAmtPerItem = Divide(cgstAmount, Item.Qty);
|
|
90
|
+
let STaxAmtPerItem = Divide(sgstAmount, Item.Qty);
|
|
91
|
+
let ITaxAmtPerItem = Divide(igstAmount, Item.Qty);
|
|
92
|
+
Item.UnPr = TrUtils.FixedTo(Add(AfterDiscForEach, CTaxAmtPerItem, STaxAmtPerItem, ITaxAmtPerItem), DecimalsNumber);
|
|
93
|
+
}else{
|
|
94
|
+
Item.UnPr = TrUtils.FixPriceValue(Item.UnPr, DecimalsNumber);
|
|
95
|
+
}
|
|
96
|
+
Item.CGSTAmt = TrUtils.FixPriceValue(cgstAmount, DecimalsNumber);
|
|
97
|
+
Item.SGSTAmt = TrUtils.FixPriceValue(sgstAmount, DecimalsNumber);
|
|
98
|
+
Item.IGSTAmt = TrUtils.FixPriceValue(igstAmount, DecimalsNumber);
|
|
99
|
+
Item.CGSTPerc = this.GetTaxRateFromTaxes(Item, 'CGST', PrintSharedService.GetCGSTValueBasedOnTaxCode(Item.TCode, TaxCodes));
|
|
100
|
+
Item.SGSTPerc = this.GetTaxRateFromTaxes(Item, 'SGST', PrintSharedService.GetSGSTValueBasedOnTaxCode(Item.TCode, TaxCodes));
|
|
101
|
+
Item.IGSTPerc = this.GetTaxRateFromTaxes(Item, 'IGST', PrintSharedService.GetIGSTValueBasedOnTaxCode(Item.TCode, TaxCodes));
|
|
102
|
+
if (LineTotal === 'AT') {
|
|
103
|
+
Item.LineTotal = TrUtils.FixPriceValue(Item.AfterPartTax, DecimalsNumber);
|
|
104
|
+
} else {
|
|
105
|
+
Item.LineTotal = TrUtils.FixPriceValue(Subtract(Item.UnAmt, Item.Disc), DecimalsNumber);
|
|
106
|
+
}
|
|
107
|
+
if (!TrUtils.IsZero(Item.Qty) && !TrUtils.CheckInvalidSelect(Item.UoM)) {
|
|
108
|
+
Item.QtyAndUoM = Item.Qty + ' ' + Item.UoM;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return Items;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
static GetTaxAmountFromTaxes(item: any, taxCode: string, fallbackAmount: any = 0) {
|
|
115
|
+
const taxes = Array.isArray(item?.Taxes) ? item.Taxes : [];
|
|
116
|
+
const matchedTaxes = taxes.filter((tax: any) => tax?.Code === taxCode);
|
|
117
|
+
if (matchedTaxes.length !== 0) {
|
|
118
|
+
return matchedTaxes.reduce((total: number, tax: any) => Add(total, tax?.Amt), 0);
|
|
119
|
+
}
|
|
120
|
+
return TrUtils.SetValueToZeroIfNull(fallbackAmount);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
static GetTaxRateFromTaxes(item: any, taxCode: string, fallbackRate: any = 0) {
|
|
124
|
+
const taxes = Array.isArray(item?.Taxes) ? item.Taxes : [];
|
|
125
|
+
const matchedTaxes = taxes.filter((tax: any) => tax?.Code === taxCode);
|
|
126
|
+
if (matchedTaxes.length !== 0) {
|
|
127
|
+
return matchedTaxes.reduce((total: number, tax: any) => Add(total, tax?.Rate), 0);
|
|
128
|
+
}
|
|
129
|
+
return TrUtils.SetValueToZeroIfNull(fallbackRate);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
static GetTCodeFromTaxes(item: any) {
|
|
133
|
+
const taxes = Array.isArray(item?.Taxes) ? item.Taxes : [];
|
|
134
|
+
const matchedTax = taxes.find((tax: any) => !TrUtils.IsNull(tax?.TaxCodeId));
|
|
135
|
+
if (!TrUtils.IsNull(matchedTax?.TaxCodeId)) {
|
|
136
|
+
return matchedTax.TaxCodeId;
|
|
137
|
+
}
|
|
138
|
+
return item?.TCode;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
static ReverseItemsForInvoicePrint(argInvoiceData: any) {
|
|
142
|
+
// argInvoiceData.Ops = argInvoiceData.Ops.reverse();
|
|
143
|
+
argInvoiceData.Items = argInvoiceData.Items.reverse();
|
|
144
|
+
return argInvoiceData;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
static PrepareFormatForInvoicePrint(InvoicePrintData: any, ROType: any, InvoiceStatus: any) {
|
|
148
|
+
let PrintInfo: any[] = [];
|
|
149
|
+
|
|
150
|
+
let ROLaborParts: any = {};
|
|
151
|
+
|
|
152
|
+
// ROLaborParts.Ops = InvoicePrintData.Ops;
|
|
153
|
+
|
|
154
|
+
ROLaborParts.Items = InvoicePrintData.Items;
|
|
155
|
+
|
|
156
|
+
ROLaborParts.Sts = InvoiceStatus;
|
|
157
|
+
ROLaborParts.Type = ROType;
|
|
158
|
+
|
|
159
|
+
PrintInfo.push(ROLaborParts);
|
|
160
|
+
return PrintInfo;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
static GetFormattedProductDataForPrint(OriginalInvoiceData: any, InvoicePrintData: any) {
|
|
164
|
+
if (!TrUtils.IsNull(OriginalInvoiceData.Prod)) {
|
|
165
|
+
InvoicePrintData.Product = OriginalInvoiceData.Prod;
|
|
166
|
+
if (TrUtils.IsNull(InvoicePrintData.Product.VIN)) {
|
|
167
|
+
InvoicePrintData.Product.VIN = '';
|
|
168
|
+
}
|
|
169
|
+
if (TrUtils.IsNull(InvoicePrintData.Product.RegNo)) {
|
|
170
|
+
InvoicePrintData.Product.RegNo = '';
|
|
171
|
+
}
|
|
172
|
+
if (TrUtils.IsNull(InvoicePrintData.Product.EngNo)) {
|
|
173
|
+
InvoicePrintData.Product.EngNo = '';
|
|
174
|
+
}
|
|
175
|
+
InvoicePrintData.MIn = OriginalInvoiceData.Prod.MIn;
|
|
176
|
+
InvoicePrintData.MOut = OriginalInvoiceData.Prod.MOut;
|
|
177
|
+
}
|
|
178
|
+
return InvoicePrintData;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
static GetBillNameForInvoicePrint(OriginalInvoiceData: any, InvoicePrintData: any) {
|
|
182
|
+
let Customer: any = {};
|
|
183
|
+
Customer.Name = OriginalInvoiceData.BillTo.Name;
|
|
184
|
+
Customer.Adrs = [];
|
|
185
|
+
Customer.Cons = [];
|
|
186
|
+
if (!TrUtils.IsNull(OriginalInvoiceData.BillTo.Adrs)) {
|
|
187
|
+
Customer.Adrs.push(OriginalInvoiceData.BillTo.Adrs.A1);
|
|
188
|
+
if (!TrUtils.IsEmpty(OriginalInvoiceData.BillTo.Adrs.A2)) {
|
|
189
|
+
Customer.Adrs.push(OriginalInvoiceData.BillTo.Adrs.A2);
|
|
190
|
+
}
|
|
191
|
+
if (!TrUtils.IsEmpty(OriginalInvoiceData.BillTo.Adrs.Ct)) {
|
|
192
|
+
Customer.Adrs.push(OriginalInvoiceData.BillTo.Adrs.Ct);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
Customer.GSTIN = OriginalInvoiceData.BillTo.GSTIN;
|
|
196
|
+
|
|
197
|
+
if (!TrUtils.IsEmpty(OriginalInvoiceData.BillTo.Ph)) {
|
|
198
|
+
Customer.Cons = [
|
|
199
|
+
{
|
|
200
|
+
Type: 'M',
|
|
201
|
+
No: OriginalInvoiceData.BillTo.Ph
|
|
202
|
+
}
|
|
203
|
+
];
|
|
204
|
+
}
|
|
205
|
+
InvoicePrintData.Customer = Customer;
|
|
206
|
+
|
|
207
|
+
if (!TrUtils.IsNull(OriginalInvoiceData.BillTo.InsId)) {
|
|
208
|
+
InvoicePrintData.Cust = this.GetCustomerDetails(OriginalInvoiceData);
|
|
209
|
+
}
|
|
210
|
+
return InvoicePrintData;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
static GetCustomerDetails(OriginalInvoiceData: any) {
|
|
214
|
+
let Customer: any = {};
|
|
215
|
+
Customer.Name = this.GetBillToName(OriginalInvoiceData.Cust.Title, OriginalInvoiceData.Cust.Name);
|
|
216
|
+
Customer.Cons = [];
|
|
217
|
+
if (!TrUtils.IsEmpty(OriginalInvoiceData.Cust.Ph)) {
|
|
218
|
+
Customer.Cons = [
|
|
219
|
+
{
|
|
220
|
+
Type: 'M',
|
|
221
|
+
No: OriginalInvoiceData.Cust.Ph
|
|
222
|
+
}
|
|
223
|
+
];
|
|
224
|
+
}
|
|
225
|
+
Customer.GSTIN = OriginalInvoiceData.Cust.GSTIN;
|
|
226
|
+
Customer.Adrs = [];
|
|
227
|
+
if (!TrUtils.IsNull(OriginalInvoiceData.Cust.Adrs)) {
|
|
228
|
+
Customer.Adrs.push(OriginalInvoiceData.Cust.Adrs.A1);
|
|
229
|
+
if (!TrUtils.IsEmpty(OriginalInvoiceData.Cust.Adrs.A2)) {
|
|
230
|
+
Customer.Adrs.push(OriginalInvoiceData.Cust.Adrs.A2);
|
|
231
|
+
}
|
|
232
|
+
Customer.Adrs.push(OriginalInvoiceData.Cust.Adrs.Ct);
|
|
233
|
+
}
|
|
234
|
+
Customer.ConName = OriginalInvoiceData.Cust.ConName;
|
|
235
|
+
Customer.ConPh = OriginalInvoiceData.Cust.ConPhone;
|
|
236
|
+
return Customer;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
static GetBillToName(Title: any, Name: string) {
|
|
240
|
+
return TrUtils.IsEmpty(Title) ? Name : Title + ' ' + Name;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// static GetPaymentsTotal(InvoicePayments: any, Total: number, InvoiceStatus: string) {
|
|
244
|
+
// var i = 0;
|
|
245
|
+
// let Data: any = {};
|
|
246
|
+
// let PaidTotal: any = 0;
|
|
247
|
+
// for (i = 0; i < InvoicePayments.length; i++) {
|
|
248
|
+
// PaidTotal += InvoicePayments[i].Paid;
|
|
249
|
+
// }
|
|
250
|
+
// if (InvoiceStatus === InvoiceStatusEnum.Closed) {
|
|
251
|
+
// Data.Due = 0;
|
|
252
|
+
// } else {
|
|
253
|
+
// Data.Due = TrUtils.FixedTo(Total - PaidTotal);
|
|
254
|
+
// }
|
|
255
|
+
// if (Data.Due < 0) {
|
|
256
|
+
// Data.Due = 0;
|
|
257
|
+
// }
|
|
258
|
+
// if (Data.Due === 0) {
|
|
259
|
+
// Data.Sts = InvoiceStatusEnum.Closed;
|
|
260
|
+
// }
|
|
261
|
+
// Data.Paid = TrUtils.FixedTo(PaidTotal);
|
|
262
|
+
// return Data;
|
|
263
|
+
// }
|
|
264
|
+
}
|