shareneus 1.4.32 → 1.4.34
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/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DebitNotePdfService = exports.DCWithoutPricePdfService = exports.DCLandscapeWithoutPricePdfService = exports.DCLandscapePdfService = exports.CustomerBalancesService = exports.SalesByCustomerPDFService = exports.CustWiseSalesDetailsService = exports.CreditNoteTotalsService = exports.CreditNotePdfService = exports.ConsultationPDFService = exports.ConsultationFullPrintService = exports.ConsultationFeeReceiptPrintService = exports.CNPrintService = exports.ChecklistsPDFService = exports.CheckListPrintService = exports.CategoryWiseItemPDFService = exports.SalesReceiptprintService = exports.AppointmentTotalsService = exports.AnalysisPDFService = exports.VenBalanceXlsxFileService = exports.TallySalesImportXlsxFileService = exports.StockXlsxFileService = exports.IssueSparesXlsxFileService = exports.ScheduledDrugXlsxFileService = exports.ScheduledDrugSummaryXlsxFileService = exports.SalesByServiceSummaryXlsxFileService = exports.SummaryXlsxFileService = exports.ServiceAdvisorWisePartXlsxFileService = exports.ServiceAdvisorWiseLaborXlsxFileService = exports.RepairOrdersXlsxFileService = exports.PaymentsMadeXlsxFileService = exports.PaymentReceiveXlsxFileService = exports.OperatorWiseSummaryXlsxFileService = exports.OperatorWiseDetailsXlsxFileService = exports.ManfWiseSalesXlsxFileService = exports.ItemsWiseSalesXlsxFileService = exports.ItemWiseMOSummaryXlsxFileService = exports.ItemWiseMODetailsXlsxFileService = exports.ItemWiseDoctorSaleXlsxFileService = exports.InvoicesWiseXlsxFileService = exports.InsuranceExpireXlsxFileService = exports.GSTR2ExcelService = exports.GSTR1ExcelService = exports.GSTROXlsxFileService = exports.ExpiringDrugsXlsxFileService = exports.SalesByCustomerXlsxFileService = exports.CustWiseSalesXlsxFileService = exports.CustBalanceXlsxFileService = exports.CategoryWiseItemXlsxFileService = exports.AnalysisXlsxFileService = void 0;
|
|
4
4
|
exports.SharedPDFService = exports.SharedInvoiceprintService = exports.WOPrintService = exports.ScheduledDrugSummaryPDFService = exports.ScheduledDrugPDFService = exports.SalesTotalsService = exports.SaleReceiptPrintService = exports.SalesReceiptpdfService = exports.SalesPrintService = exports.SalesPdfService = exports.SalesByServiceSummaryPDF = exports.ROTotalsService = exports.ROPrintService = exports.RoprintService = exports.RepairOrdersReportsPDFService = exports.ReorderPointPDFService = exports.ReceiptPrintService = exports.PurchaseOrderPDFService = exports.PurchaseOrderTotalsService = exports.PurchaseOrderPrintService = exports.PosReceiptPrintService = exports.POTotalsService = exports.PaymentsReportPDFService = exports.ReceiptPDFService = exports.PackShipPrintService = exports.PackShipPDFService = exports.OperatorWiseSalesSummaryPDF = exports.OperatorWiseSalesDetailsPDF = exports.MaterialOutprintService = exports.MeetingPdfService = exports.ManfWiseSalesService = exports.ItemWiseSalesPDFService = exports.ItemWiseMOSummaryPDF = exports.ItemWiseMODetailsPDF = exports.ItemWiseDoctorSalePDFService = exports.ItemDetaisPdf = exports.IssuePartsprintService = exports.InvoiceTotalsService = exports.InvoiceLandscapePdfService = exports.InvPrintService = exports.InvoiceprintService = exports.InsuranceExpirePDF = exports.ExpiringDrugPDFService = exports.EstPrintService = exports.EquipmentDesignPdf = exports.DeliveryChallanTotalsService = exports.DeliveryChallanPrintService = exports.DeliveryChallanPdfService = exports.DebitNoteTotalsService = exports.DebitNotePrintService = void 0;
|
|
5
|
-
exports.ItemBarCodeLabelPdf = exports.NextServiceDatePDFService = exports.NextServiceDateXlsxFileService = exports.ConsultationLetterHeadPDFService = exports.InvoiceLetterheadPdfService = exports.HCInvoiceprintService = exports.InvoicePortraitPrintService = exports.MyDate = exports.TrUtils = exports.VendorDebitNoteTotalsService = exports.VendorDebitNotePrintService = exports.VendorDebitNotePdfService = exports.VendorCreditNoteTotalsService = exports.VendorCreditNotePrintService = exports.VendorCreditNotePDFService = exports.VendorBalancesService = exports.TransferOrderPrintService = exports.TechnicianPrintService = exports.TechnicianpdfService = exports.TaskReportsPDfService = exports.TaskPDfService = exports.PrintSharedService = void 0;
|
|
5
|
+
exports.IsNull = exports.IsNotNull = exports.PricelistItemFinalPriceService = exports.ItemBarCodeLabelPdf = exports.NextServiceDatePDFService = exports.NextServiceDateXlsxFileService = exports.ConsultationLetterHeadPDFService = exports.InvoiceLetterheadPdfService = exports.HCInvoiceprintService = exports.InvoicePortraitPrintService = exports.MyDate = exports.TrUtils = exports.VendorDebitNoteTotalsService = exports.VendorDebitNotePrintService = exports.VendorDebitNotePdfService = exports.VendorCreditNoteTotalsService = exports.VendorCreditNotePrintService = exports.VendorCreditNotePDFService = exports.VendorBalancesService = exports.TransferOrderPrintService = exports.TechnicianPrintService = exports.TechnicianpdfService = exports.TaskReportsPDfService = exports.TaskPDfService = exports.PrintSharedService = void 0;
|
|
6
6
|
var analysis_excel_service_1 = require("./excel-files/analysis-excel.service");
|
|
7
7
|
Object.defineProperty(exports, "AnalysisXlsxFileService", { enumerable: true, get: function () { return analysis_excel_service_1.AnalysisXlsxFileService; } });
|
|
8
8
|
var category_wise_item_excel_service_1 = require("./excel-files/category-wise-item-excel.service");
|
|
@@ -247,3 +247,8 @@ var next_service_date_pdf_service_1 = require("./services/next-service-date-pdf.
|
|
|
247
247
|
Object.defineProperty(exports, "NextServiceDatePDFService", { enumerable: true, get: function () { return next_service_date_pdf_service_1.NextServiceDatePDFService; } });
|
|
248
248
|
var item_bar_code_label_pdf_1 = require("./services/item-bar-code-label-pdf");
|
|
249
249
|
Object.defineProperty(exports, "ItemBarCodeLabelPdf", { enumerable: true, get: function () { return item_bar_code_label_pdf_1.ItemBarCodeLabelPdf; } });
|
|
250
|
+
var pricelist_item_final_price_service_1 = require("./services/pricelist-item-final-price.service");
|
|
251
|
+
Object.defineProperty(exports, "PricelistItemFinalPriceService", { enumerable: true, get: function () { return pricelist_item_final_price_service_1.PricelistItemFinalPriceService; } });
|
|
252
|
+
var tr_utils_2 = require("./utils/tr-utils");
|
|
253
|
+
Object.defineProperty(exports, "IsNotNull", { enumerable: true, get: function () { return tr_utils_2.IsNotNull; } });
|
|
254
|
+
Object.defineProperty(exports, "IsNull", { enumerable: true, get: function () { return tr_utils_2.IsNull; } });
|
|
@@ -412,10 +412,10 @@ class DebitNotePdfService {
|
|
|
412
412
|
else {
|
|
413
413
|
if (ShowIGST) {
|
|
414
414
|
if (ShowDiscountColumn) {
|
|
415
|
-
return [
|
|
415
|
+
return [20, "*", 60, 17, 35, 17, 35, 60];
|
|
416
416
|
}
|
|
417
417
|
else {
|
|
418
|
-
return [
|
|
418
|
+
return [20, '*', 40, 25, 40, 60];
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
421
|
else {
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PricelistItemFinalPriceService = void 0;
|
|
4
|
+
const aggregation_1 = require("../aggregation/aggregation");
|
|
5
|
+
const tr_utils_1 = require("../utils/tr-utils");
|
|
6
|
+
class PricelistItemFinalPriceService {
|
|
7
|
+
static GetItemPriceForPriceList(item, priceList, includeMargin) {
|
|
8
|
+
let salePricesByPriceListId = [];
|
|
9
|
+
if ((0, tr_utils_1.IsNotNull)(item.SalePrices) && item.SalePrices.length > 0) {
|
|
10
|
+
salePricesByPriceListId = item.SalePrices.filter((price) => priceList._id.toString() == price.PrListId.toString());
|
|
11
|
+
}
|
|
12
|
+
if (salePricesByPriceListId.length > 0) {
|
|
13
|
+
item.SalePrices = salePricesByPriceListId;
|
|
14
|
+
if (item.Track == 'TR' || item.Track == 'SN') {
|
|
15
|
+
item.Sale["MRP"] = item.Sale.Price;
|
|
16
|
+
if ((0, tr_utils_1.IsNotNull)(item.SalePrices[0].Price) && (0, tr_utils_1.IsNotNull)(item.SalePrices[0].Disc)) {
|
|
17
|
+
const calculatedPrice = this.CalcDiscPrice(item.SalePrices[0].Price, item.SalePrices[0].Disc);
|
|
18
|
+
item.Sale.Price = this.applyRounding(calculatedPrice, priceList);
|
|
19
|
+
}
|
|
20
|
+
else if ((0, tr_utils_1.IsNotNull)(item.SalePrices[0].Price) && (0, tr_utils_1.IsNull)(item.SalePrices[0].Disc)) {
|
|
21
|
+
item.Sale.Price = this.applyRounding(item.SalePrices[0].Price, priceList);
|
|
22
|
+
}
|
|
23
|
+
else if ((0, tr_utils_1.IsNull)(item.SalePrices[0].Price) && (0, tr_utils_1.IsNotNull)(item.SalePrices[0].Disc)) {
|
|
24
|
+
const calculatedPrice = this.CalcDiscPrice(item.Sale.Price, item.SalePrices[0].Disc);
|
|
25
|
+
item.Sale.Price = this.applyRounding(calculatedPrice, priceList);
|
|
26
|
+
}
|
|
27
|
+
if (includeMargin) {
|
|
28
|
+
item.Margin = this.GetMarginValue(item.Sale.Price, item.Pur.Cost);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
else if (item.Track == 'BN') {
|
|
32
|
+
for (let index = 0; index < item.Batches.length; index++) {
|
|
33
|
+
const element = item.Batches[index];
|
|
34
|
+
let batchSalePrice = item.SalePrices.filter((batch) => priceList._id.toString() == batch.PrListId.toString() && element.BN == batch.BN);
|
|
35
|
+
if (batchSalePrice.length == 0) {
|
|
36
|
+
batchSalePrice = item.SalePrices.filter((batch) => priceList._id.toString() == batch.PrListId.toString() && batch.BN == null);
|
|
37
|
+
}
|
|
38
|
+
element.MRP = element.Price;
|
|
39
|
+
if (batchSalePrice.length > 0) {
|
|
40
|
+
if ((0, tr_utils_1.IsNotNull)(batchSalePrice[0].Price) && (0, tr_utils_1.IsNotNull)(batchSalePrice[0].Disc)) {
|
|
41
|
+
const calculatedPrice = this.CalcDiscPrice(batchSalePrice[0].Price, batchSalePrice[0].Disc);
|
|
42
|
+
element.Price = this.applyRounding(calculatedPrice, priceList);
|
|
43
|
+
}
|
|
44
|
+
else if ((0, tr_utils_1.IsNotNull)(batchSalePrice[0].Price) && (0, tr_utils_1.IsNull)(batchSalePrice[0].Disc)) {
|
|
45
|
+
element.Price = this.applyRounding(batchSalePrice[0].Price, priceList);
|
|
46
|
+
}
|
|
47
|
+
else if ((0, tr_utils_1.IsNull)(batchSalePrice[0].Price) && (0, tr_utils_1.IsNotNull)(batchSalePrice[0].Disc)) {
|
|
48
|
+
const calculatedPrice = this.CalcDiscPrice(element.Price, batchSalePrice[0].Disc);
|
|
49
|
+
element.Price = this.applyRounding(calculatedPrice, priceList);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (includeMargin) {
|
|
53
|
+
element.Margin = this.GetMarginValue(element.Price, element.Cost);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return item;
|
|
58
|
+
}
|
|
59
|
+
return this.calculatePriceBasedOnPriceList(item, priceList, includeMargin);
|
|
60
|
+
}
|
|
61
|
+
static calculatePriceBasedOnPriceList(item, priceList, includeMargin) {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
if (priceList != null) {
|
|
64
|
+
if (priceList.PrCalc == "FIXED") {
|
|
65
|
+
if (priceList.Fixed && (0, tr_utils_1.IsNotNull)(priceList.Fixed.Price)) {
|
|
66
|
+
const fixedPrice = priceList.Fixed.Price;
|
|
67
|
+
if (item.Track == 'TR' || item.Track == 'SN') {
|
|
68
|
+
item.Sale["MRP"] = item.Sale.Price;
|
|
69
|
+
item.Sale.Price = this.applyRounding(fixedPrice, priceList);
|
|
70
|
+
if (includeMargin) {
|
|
71
|
+
item.Margin = this.GetMarginValue(item.Sale.Price, item.Pur.Cost);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else if (item.Track == 'BN') {
|
|
75
|
+
for (let batch of item.Batches) {
|
|
76
|
+
batch.MRP = batch.Price;
|
|
77
|
+
batch.Price = this.applyRounding(fixedPrice, priceList);
|
|
78
|
+
if (includeMargin) {
|
|
79
|
+
batch.Margin = this.GetMarginValue(batch.Price, batch.Cost);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else if (priceList.PrCalc == "DISC") {
|
|
86
|
+
const calcDisc = (_a = priceList.CalcDisc) !== null && _a !== void 0 ? _a : {};
|
|
87
|
+
let discPerc = calcDisc.Perc || 0;
|
|
88
|
+
let markUp = (_b = calcDisc.Mark) !== null && _b !== void 0 ? _b : false;
|
|
89
|
+
if (priceList.BasedOn == "SP") {
|
|
90
|
+
if (item.Track == 'TR' || item.Track == 'SN') {
|
|
91
|
+
item.Sale["MRP"] = item.Sale.Price;
|
|
92
|
+
const calculatedPrice = this.CalcDiscPrice(item.Sale.Price, discPerc, markUp);
|
|
93
|
+
item.Sale.Price = this.applyRounding(calculatedPrice, priceList);
|
|
94
|
+
if (includeMargin) {
|
|
95
|
+
item.Margin = this.GetMarginValue(item.Sale.Price, item.Pur.Cost);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else if (item.Track == 'BN') {
|
|
99
|
+
for (let batch of item.Batches) {
|
|
100
|
+
batch.MRP = batch.Price;
|
|
101
|
+
const calculatedPrice = this.CalcDiscPrice(batch.Price, discPerc, markUp);
|
|
102
|
+
batch.Price = this.applyRounding(calculatedPrice, priceList);
|
|
103
|
+
if (includeMargin) {
|
|
104
|
+
batch.Margin = this.GetMarginValue(batch.Price, batch.Cost);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else if (priceList.BasedOn == "PC") {
|
|
110
|
+
if (item.Track == 'TR' || item.Track == 'SN') {
|
|
111
|
+
item.Sale["MRP"] = item.Sale.Price;
|
|
112
|
+
if ((0, tr_utils_1.IsNotNull)(item.Pur) && (0, tr_utils_1.IsNotNull)(item.Pur.Cost)) {
|
|
113
|
+
const calculatedPrice = this.CalcDiscPrice(item.Pur.Cost, discPerc, markUp);
|
|
114
|
+
item.Sale.Price = this.applyRounding(calculatedPrice, priceList);
|
|
115
|
+
if (includeMargin) {
|
|
116
|
+
item.Margin = this.GetMarginValue(item.Sale.Price, item.Pur.Cost);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else if (item.Track == 'BN') {
|
|
121
|
+
for (let batch of item.Batches) {
|
|
122
|
+
batch.MRP = batch.Price;
|
|
123
|
+
if ((0, tr_utils_1.IsNotNull)(batch.Cost)) {
|
|
124
|
+
const calculatedPrice = this.CalcDiscPrice(batch.Cost, discPerc, markUp);
|
|
125
|
+
batch.Price = this.applyRounding(calculatedPrice, priceList);
|
|
126
|
+
if (includeMargin) {
|
|
127
|
+
batch.Margin = this.GetMarginValue(batch.Price, batch.Cost);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return item;
|
|
136
|
+
}
|
|
137
|
+
static applyRounding(price, priceList) {
|
|
138
|
+
if (!priceList || !priceList.Round)
|
|
139
|
+
return price;
|
|
140
|
+
switch (priceList.Round) {
|
|
141
|
+
case "-1":
|
|
142
|
+
return price;
|
|
143
|
+
case "0":
|
|
144
|
+
return Math.round(price);
|
|
145
|
+
case "0.99":
|
|
146
|
+
return Math.floor(price) + 0.99;
|
|
147
|
+
case "0.50":
|
|
148
|
+
return Math.round(price * 2) / 2;
|
|
149
|
+
case "0.49":
|
|
150
|
+
return Math.floor(price) + 0.49;
|
|
151
|
+
case "Dec":
|
|
152
|
+
if ((0, tr_utils_1.IsNotNull)(priceList.Deci)) {
|
|
153
|
+
const factor = Math.pow(10, priceList.Deci);
|
|
154
|
+
return Math.round(price * factor) / factor;
|
|
155
|
+
}
|
|
156
|
+
return price;
|
|
157
|
+
default:
|
|
158
|
+
return price;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
static CalcDiscPrice(Price, Disc, MarkUp = false) {
|
|
162
|
+
let PriceValue = 0;
|
|
163
|
+
if (MarkUp) {
|
|
164
|
+
PriceValue = (0, aggregation_1.addition)(Price, (0, aggregation_1.division)((0, aggregation_1.multiply)(Price, Disc), 100));
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
PriceValue = (0, aggregation_1.subtraction)(Price, (0, aggregation_1.division)((0, aggregation_1.multiply)(Price, Disc), 100));
|
|
168
|
+
}
|
|
169
|
+
return PriceValue;
|
|
170
|
+
}
|
|
171
|
+
static GetMarginValue(price, cost) {
|
|
172
|
+
let Margin = 0;
|
|
173
|
+
Margin = (0, aggregation_1.multiply)((0, aggregation_1.division)((0, aggregation_1.subtraction)(price, cost), price), 100);
|
|
174
|
+
return Margin;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
exports.PricelistItemFinalPriceService = PricelistItemFinalPriceService;
|
|
@@ -33,6 +33,9 @@ class VendorDebitNoteTotalsService {
|
|
|
33
33
|
static ResetLaborItemValues(ItemsList, IsIndependentTax) {
|
|
34
34
|
ItemsList.forEach((Item) => {
|
|
35
35
|
Item = this.ResetLaborItemValueIfInvalid(Item);
|
|
36
|
+
if (tr_utils_1.TrUtils.IsZero(Item.Qty)) {
|
|
37
|
+
Item.Qty = 1;
|
|
38
|
+
}
|
|
36
39
|
Item.DiscountedPrice = (0, aggregation_1.addition)(Item.Disc, Item.RecDisc);
|
|
37
40
|
Item.AfterItemDisc = Item.NetAmt;
|
|
38
41
|
if (IsIndependentTax) {
|
package/dist/utils/tr-utils.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TrUtils = void 0;
|
|
4
|
+
exports.IsNull = IsNull;
|
|
5
|
+
exports.IsNotNull = IsNotNull;
|
|
4
6
|
// import { HttpClient } from '@angular/common/http';
|
|
5
7
|
const enums_1 = require("../enums/enums");
|
|
6
8
|
var deepEqual = require('deep-equal');
|
|
7
9
|
// import { LaborStatusEnum } from '../enums/enums';
|
|
10
|
+
function IsNull(Value) {
|
|
11
|
+
return Value === null || typeof Value === 'undefined';
|
|
12
|
+
}
|
|
13
|
+
function IsNotNull(Value) {
|
|
14
|
+
return Value !== null && typeof Value !== 'undefined';
|
|
15
|
+
}
|
|
8
16
|
class TrUtils {
|
|
9
17
|
static IsNull(Value) {
|
|
10
18
|
return Value === null || typeof Value === 'undefined';
|