Merge remote-tracking branch 'origin/master-AIO' into feature/IO-2743-Production-Board-GridDND
This commit is contained in:
@@ -891,22 +891,19 @@ function checkStateTax(jobline, jobs_by_pk) {
|
||||
}
|
||||
|
||||
const isAdditionalCost =
|
||||
(jobline.lbr_op === "OP13" || (jobline.db_ref && jobline.db_ref.startsWith("9360"))) && !isPaintOrShopMat;
|
||||
(jobline.lbr_op === "OP13" ||
|
||||
(jobline.lbr_op === "OP14" && jobline.act_price > 0 && jobline.mod_lb_hrs === 0) ||
|
||||
(jobline.db_ref && jobline.db_ref.startsWith("9360")) ||
|
||||
(jobline.db_ref && jobline.db_ref.startsWith("90051"))) &&
|
||||
!isPaintOrShopMat;
|
||||
|
||||
if (!jobline.part_type && isAdditionalCost) {
|
||||
if (jobs_by_pk.tax_lbr_rt === 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
if (!jobline.part_type && isAdditionalCost) {
|
||||
if (jobs_by_pk.tax_lbr_rt === 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
jobline.db_ref === "900511" ||
|
||||
jobline.db_ref === "900510" ||
|
||||
(jobline.mod_lb_hrs === 0 && jobline.act_price > 0 && jobline.lbr_op === "OP14")
|
||||
)
|
||||
return true; //Extending IO-1375 as a part of IO-2023
|
||||
|
||||
if (jobline.tax_part === false) {
|
||||
return false;
|
||||
|
||||
@@ -318,7 +318,9 @@ function GenerateCostingData(job) {
|
||||
if (!partsProfitCenter)
|
||||
console.log("Unknown cost/profit center mapping for parts.", val.line_desc, val.part_type);
|
||||
const partsAmount = Dinero({
|
||||
amount: val.act_price_before_ppc ? Math.round(val.act_price_before_ppc * 100) : Math.round(val.act_price * 100)
|
||||
amount: val.act_price_before_ppc
|
||||
? Math.round(val.act_price_before_ppc * 100)
|
||||
: Math.round(val.act_price * 100)
|
||||
})
|
||||
.multiply(val.part_qty || 1)
|
||||
.add(
|
||||
@@ -327,7 +329,9 @@ function GenerateCostingData(job) {
|
||||
? val.prt_dsmk_m
|
||||
? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) })
|
||||
: Dinero({
|
||||
amount: val.act_price_before_ppc ? Math.round(val.act_price_before_ppc * 100) : Math.round(val.act_price * 100)
|
||||
amount: val.act_price_before_ppc
|
||||
? Math.round(val.act_price_before_ppc * 100)
|
||||
: Math.round(val.act_price * 100)
|
||||
})
|
||||
.multiply(val.part_qty || 0)
|
||||
.percentage(Math.abs(val.prt_dsmk_p || 0))
|
||||
@@ -368,7 +372,10 @@ function GenerateCostingData(job) {
|
||||
}
|
||||
|
||||
//Additional Profit Center
|
||||
if ((!val.part_type && !val.mod_lbr_ty) || (!val.part_type && val.mod_lbr_ty)) {
|
||||
if (
|
||||
(!val.part_type && !val.mod_lbr_ty) ||
|
||||
(!val.part_type && val.mod_lbr_ty && val.act_price > 0 && val.lbr_op !== "OP14")
|
||||
) {
|
||||
//Does it already have a defined profit center?
|
||||
//If so, use it, otherwise try to use the same from the auto-allocate logic in IO app jobs-close-auto-allocate.
|
||||
const partsProfitCenter = val.profitcenter_part || getAdditionalCostCenter(val, defaultProfits) || "Unknown";
|
||||
|
||||
@@ -909,6 +909,25 @@ function CalculateTaxesTotals(job, otherTotals) {
|
||||
}
|
||||
});
|
||||
|
||||
if (job.adjustment_bottom_line) {
|
||||
const subtotal_before_adjustment = subtotal.add(Dinero({ amount: Math.round(job.adjustment_bottom_line * -100) }));
|
||||
const percent_of_adjustment =
|
||||
Math.round(
|
||||
subtotal_before_adjustment.toUnit() /
|
||||
(job.adjustment_bottom_line > 0 ? job.adjustment_bottom_line : job.adjustment_bottom_line * -1)
|
||||
) / 100;
|
||||
|
||||
Object.keys(taxableAmountsByTier).forEach((taxTierKey) => {
|
||||
taxable_adjustment = taxableAmountsByTier[taxTierKey].multiply(percent_of_adjustment);
|
||||
console.log("🚀 ~ taxableAmountsByTier ~ taxable_adjustment:", taxable_adjustment)
|
||||
if (job.adjustment_bottom_line > 0) {
|
||||
taxableAmountsByTier[taxTierKey] = taxableAmountsByTier[taxTierKey].add(taxable_adjustment);
|
||||
} else {
|
||||
taxableAmountsByTier[taxTierKey] = taxableAmountsByTier[taxTierKey].subtract(taxable_adjustment);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const remainingTaxableAmounts = taxableAmountsByTier;
|
||||
console.log("*** Taxable Amounts by Tier***");
|
||||
console.table(JSON.parse(JSON.stringify(taxableAmountsByTier)));
|
||||
|
||||
Reference in New Issue
Block a user