ARMS Uploader
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -30,6 +31,7 @@ query ENTEGRAL_EXPORT($bodyshopid: uuid!, $start: timestamptz!, $end: timestampt
|
||||
actual_completion
|
||||
actual_delivery
|
||||
date_exported
|
||||
actual_in
|
||||
ins_co_nm
|
||||
ins_addr1
|
||||
ins_addr2
|
||||
@@ -163,9 +165,9 @@ query ENTEGRAL_EXPORT($bodyshopid: uuid!, $start: timestamptz!, $end: timestampt
|
||||
logger.Debug(RoNumber);
|
||||
RepairOrders.Add(new ARMSRoDataModel()
|
||||
{
|
||||
ShopShortName = int.Parse(data.bodyshops_by_pk.entegral_id?.Value),
|
||||
ShopShortName = data.bodyshops_by_pk.entegral_id?.Value,
|
||||
RO = int.Parse(RoNumber),
|
||||
TransType = "Z", //TODO*** Finish this status mapping.
|
||||
TransType = job.actual_completion?.Value == null ? "Z" : "C", //TODO*** Finish this status mapping.
|
||||
ShopLongName = data.bodyshops_by_pk.shopname?.Value,
|
||||
EstimatorID = job.est_ct_ln,
|
||||
EstimatorName = $"{job.est_ct_fn} {job.est_ct_ln}",
|
||||
@@ -175,8 +177,10 @@ query ENTEGRAL_EXPORT($bodyshopid: uuid!, $start: timestamptz!, $end: timestampt
|
||||
CustomerStreet = job.ownr_addr1?.Value,
|
||||
CustomerCity = job.ownr_city?.Value,
|
||||
CustomerState = job.ownr_st?.Value,
|
||||
CustomerZip = job.ownr_ph1?.Value,
|
||||
RetWhslCustomer = "R",
|
||||
CustomerZip = job.ownr_zip?.Value,
|
||||
CustomerPhone1 = job.ownr_ph1?.Value,
|
||||
CustomerPhone2 = job.ownr_ph2?.Value,
|
||||
//RetWhslCustomer = "R",
|
||||
Year = int.Parse(job.v_model_yr?.Value ?? 0), //TODO STRIP TO 2 NUMBERS
|
||||
Make = job.v_make_desc?.Value,
|
||||
Model = job.v_model_desc?.Value,
|
||||
@@ -191,8 +195,11 @@ query ENTEGRAL_EXPORT($bodyshopid: uuid!, $start: timestamptz!, $end: timestampt
|
||||
ClaimType = "N/A",
|
||||
Claim = job.clm_no?.Value,
|
||||
DateOpened = job.date_open?.Value,// ? job.date_open : null,
|
||||
EstComplete = job.date_open?.Value,
|
||||
//DateofLoss = job.loss_date?.Value,// ? job.loss_date : null,
|
||||
PromiseDate = job.scheduled_completion,
|
||||
CarComplete = job.actual_completion,
|
||||
CarinShop = job.actual_in,
|
||||
CustPickup = job.actual_delivery,
|
||||
DateClosed = job.date_invoiced,
|
||||
BodyRate = job.rate_lab,
|
||||
@@ -201,33 +208,35 @@ query ENTEGRAL_EXPORT($bodyshopid: uuid!, $start: timestamptz!, $end: timestampt
|
||||
StructuralRate = job.rate_las,
|
||||
PMRate = job.rate_mapa,
|
||||
BMRate = job.rate_mash,
|
||||
RevisedTotalsBodyHours = job.job_totals?.rates?.lab?.hours?.Value,
|
||||
RevisedTotalsRefinishHours = job.job_totals?.rates?.lar?.hours?.Value,
|
||||
RevisedTotalsMechanicalHours = job.job_totals?.rates?.lam?.hours?.Value,
|
||||
RevisedTotalsStructuralHours = job.job_totals?.rates?.las?.hours?.Value,
|
||||
RevisedTotalsPartsTotal = job.job_totals?.pars?.parts?.total?.amount?.Value/100,
|
||||
RevisedTotalsSubletTotal = job.job_totals?.pars?.sublets?.total?.amount?.Value / 100,
|
||||
RevisedTotalsBodyLaborTotal = job.job_totals?.rates?.lab?.total?.amount?.Value/100,
|
||||
RevisedTotalsRefinishLaborTotal = job.job_totals?.rates?.lar?.total?.amount?.Value / 100,
|
||||
RevisedTotalsMechanicalLaborTotal = job.job_totals?.rates?.lam?.total?.amount?.Value / 100,
|
||||
RevisedTotalsStructuralLaborTotal = job.job_totals?.rates?.las?.total?.amount?.Value / 100,
|
||||
RevisedTotalsPMTotal = job.job_totals?.rates?.mapa?.total?.amount?.Value / 100,
|
||||
RevisedTotalsBMTotal = job.job_totals?.rates?.mash?.total?.amount?.Value / 100,
|
||||
RevisedTotalsSalesTaxTotal = (job.job_totals?.totals?.federal_tax?.amount?.Value + job.job_totals?.totals?.state_tax?.amount?.Value) /100,
|
||||
RevisedTotalsGrossTotal = job.job_totals?.totals?.total_repairs?.amount?.Value /100,
|
||||
RevisedTotalsDeductibleTotal = job.ded_amt?.Value,
|
||||
// RevisedTotalsDepreciationTotal = job.job_totals?.rates?.lab?.hours?.Value,
|
||||
RevisedTotalsBodyHours = (Decimal?)job.job_totals?.rates?.lab?.hours?.Value,
|
||||
RevisedTotalsRefinishHours = (Decimal?)job.job_totals?.rates?.lar?.hours?.Value,
|
||||
RevisedTotalsMechanicalHours = (Decimal?)job.job_totals?.rates?.lam?.hours?.Value,
|
||||
RevisedTotalsStructuralHours = (Decimal?)job.job_totals?.rates?.las?.hours?.Value,
|
||||
RevisedTotalsPartsTotal = ((Decimal?)job.job_totals?.parts?.parts?.total?.amount?.Value) / 100,
|
||||
RevisedTotalsSubletTotal = ((Decimal?)job.job_totals?.parts?.sublets?.total?.amount?.Value) / 100,
|
||||
RevisedTotalsBodyLaborTotal = ((Decimal?)job.job_totals?.rates?.lab?.total?.amount?.Value) / 100,
|
||||
RevisedTotalsRefinishLaborTotal = ((Decimal?)job.job_totals?.rates?.lar?.total?.amount?.Value) / 100,
|
||||
RevisedTotalsMechanicalLaborTotal = ((Decimal?)job.job_totals?.rates?.lam?.total?.amount?.Value) / 100,
|
||||
RevisedTotalsStructuralLaborTotal = ((Decimal?)job.job_totals?.rates?.las?.total?.amount?.Value) / 100,
|
||||
RevisedTotalsPMTotal = ((Decimal?)job.job_totals?.rates?.mapa?.total?.amount?.Value) / 100,
|
||||
RevisedTotalsBMTotal = ((Decimal?)job.job_totals?.rates?.mash?.total?.amount?.Value) / 100,
|
||||
RevisedTotalsSalesTaxTotal = ((Decimal?)(job.job_totals?.totals?.federal_tax?.amount?.Value + job.job_totals?.totals?.state_tax?.amount?.Value)) / 100,
|
||||
RevisedTotalsGrossTotal = ((Decimal?)job.job_totals?.totals?.total_repairs?.amount?.Value) / 100,
|
||||
RevisedTotalsDeductibleTotal = (Decimal?)job.ded_amt?.Value,
|
||||
// RevisedTotalsDepreciationTotal = job.job_totals?.rates?.lab?.hours?.Value,
|
||||
TotalLossYN = job.tlos_ind,
|
||||
BodyTechName = job.employee_body_rel?.Value == null ? "" : $"{job.employee_body_rel?.first_name?.Value} {job.employee_body_rel?.last_name?.Value}",
|
||||
Vehiclecolor = job.v_color?.Value,
|
||||
PaintTechID = job.employee_refinish_rel?.Value == null ? "" : job.employee_refinish_rel?.employee_number?.Value,
|
||||
PaintTechName = job.employee_refinish_rel?.Value == null ? "" : $"{job.employee_refinish_rel?.first_name?.Value} {job.employee_refinish_rel?.last_name?.Value}",
|
||||
ProductionStageCode = "33" //TODO ADD THE REST OF THE CODE
|
||||
ProductionStageCode = (job.actual_delivery?.Value != null || job.date_invoiced != null) ? "8D" : "33",
|
||||
Vehiclescheduledindate = job.scheduled_in?.Value
|
||||
});
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(Properties.Settings.Default.ArmsExportPath);
|
||||
|
||||
engine.WriteFile("Output.Txt", RepairOrders);
|
||||
engine.WriteFile($"{Properties.Settings.Default.ArmsExportPath}\\{DateTime.Now.ToString("MMdd")}{data.bodyshops_by_pk.entegral_id?.Value}.txt", RepairOrders);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -7,24 +7,13 @@ using FileHelpers;
|
||||
|
||||
namespace BodyshopPartner.Utils
|
||||
{
|
||||
|
||||
|
||||
[FixedLengthRecord()]
|
||||
public class ARMSRoDataModel
|
||||
{
|
||||
[FieldFixedLength(5)]
|
||||
public int CustId;
|
||||
|
||||
[FieldFixedLength(30)]
|
||||
[FieldTrim(TrimMode.Both)]
|
||||
public string Name;
|
||||
|
||||
[FieldFixedLength(8)]
|
||||
[FieldConverter(ConverterKind.Date, "ddMMyyyy")]
|
||||
public DateTime? AddedDate;
|
||||
|
||||
|
||||
|
||||
[FieldFixedLength(8)]
|
||||
public int ShopShortName;
|
||||
public string ShopShortName;
|
||||
[FieldFixedLength(8)]
|
||||
public int RO;
|
||||
[FieldFixedLength(1)]
|
||||
@@ -52,9 +41,9 @@ namespace BodyshopPartner.Utils
|
||||
[FieldFixedLength(11)]
|
||||
public String CustomerZip;
|
||||
[FieldFixedLength(10)]
|
||||
public int CustomerPhone1;
|
||||
public String CustomerPhone1;
|
||||
[FieldFixedLength(10)]
|
||||
public int CustomerPhone2;
|
||||
public String CustomerPhone2;
|
||||
[FieldFixedLength(35)]
|
||||
public String CustomerSource;
|
||||
[FieldFixedLength(1)]
|
||||
@@ -92,9 +81,9 @@ namespace BodyshopPartner.Utils
|
||||
[FieldFixedLength(11)]
|
||||
public String InsuranceZip;
|
||||
[FieldFixedLength(10)]
|
||||
public int InsurancePhone;
|
||||
public String InsurancePhone;
|
||||
[FieldFixedLength(10)]
|
||||
public int InsuranceFax;
|
||||
public String InsuranceFax;
|
||||
[FieldFixedLength(4)]
|
||||
public String ClaimType;
|
||||
|
||||
@@ -132,7 +121,7 @@ namespace BodyshopPartner.Utils
|
||||
[FieldFixedLength(35)]
|
||||
public String InsuranceAgentFirstName;
|
||||
[FieldFixedLength(10)]
|
||||
public int InsAgentPhone;
|
||||
public String InsAgentPhone;
|
||||
|
||||
[FieldFixedLength(8)]
|
||||
[FieldConverter(ConverterKind.Date, "ddMMyyyy")]
|
||||
@@ -183,184 +172,250 @@ namespace BodyshopPartner.Utils
|
||||
public DateTime? DateClosed;
|
||||
|
||||
[FieldFixedLength(12)]
|
||||
public Double? BodyRate;
|
||||
public Decimal? BodyRate;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RefinishRate;
|
||||
public Decimal? RefinishRate;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? MechanicalRate;
|
||||
public Decimal? MechanicalRate;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? StructuralRate;
|
||||
public Decimal? StructuralRate;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? PMRate;
|
||||
public Decimal? PMRate;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? BMRate;
|
||||
public Decimal? BMRate;
|
||||
[FieldFixedLength(7)]
|
||||
public Double? RetailWholesaleTaxRate;
|
||||
public Decimal? RetailWholesaleTaxRate;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? StorageRateperDay;
|
||||
public Decimal? StorageRateperDay;
|
||||
[FieldFixedLength(3)]
|
||||
public Double? DaysStored;
|
||||
public Decimal? DaysStored;
|
||||
|
||||
[FieldFixedLength(5)]
|
||||
public Double? BodyHours;
|
||||
public Decimal? BodyHours;
|
||||
[FieldFixedLength(5)]
|
||||
public Double? RefinishHours;
|
||||
public Decimal? RefinishHours;
|
||||
[FieldFixedLength(5)]
|
||||
public Double? MechanicalHours;
|
||||
public Decimal? MechanicalHours;
|
||||
[FieldFixedLength(5)]
|
||||
public Double? StructuralHours;
|
||||
public Decimal? StructuralHours;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? PartsTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? PartsTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SubletTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SubletTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? BodyLaborTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? BodyLaborTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RefinishLaborTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RefinishLaborTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? MechanicalLaborTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? MechanicalLaborTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? StructuralLaborTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? StructuralLaborTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? MiscellaneousChargeTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? MiscellaneousChargeTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? PMTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? PMTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? BMTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? BMTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? MiscTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? MiscTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? TowingTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? TowingTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? StorageTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? StorageTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? DetailTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? DetailTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SalesTaxTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SalesTaxTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? GrossTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? GrossTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? DeductibleTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? DeductibleTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? DepreciationTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? DepreciationTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? Discount;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? Discount;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? CustomerPay;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? CustomerPay;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? InsurancePay;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? InsurancePay;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? Deposit;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? Deposit;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? AmountDue;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? AmountDue;
|
||||
|
||||
[FieldFixedLength(5)]
|
||||
public Double? SupplementBodyHours;
|
||||
public Decimal? SupplementBodyHours;
|
||||
[FieldFixedLength(5)]
|
||||
public Double? SupplementRefinishHours;
|
||||
public Decimal? SupplementRefinishHours;
|
||||
[FieldFixedLength(5)]
|
||||
public Double? SupplementMechanicalHours;
|
||||
public Decimal? SupplementMechanicalHours;
|
||||
[FieldFixedLength(5)]
|
||||
public Double? SupplementStructuralHours;
|
||||
public Decimal? SupplementStructuralHours;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementPartsTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementPartsTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementSubletTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementSubletTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementBodyLaborTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementBodyLaborTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementRefinishLaborTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementRefinishLaborTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementMechanicalLaborTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementMechanicalLaborTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementStructuralLaborTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementStructuralLaborTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementMiscellaneousChargeTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementMiscellaneousChargeTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementPMTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementPMTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementBMTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementBMTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementMiscTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementMiscTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementTowingTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementTowingTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementStorageTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementStorageTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementDetailTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementDetailTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementSalesTaxTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementSalesTaxTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementGrossTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementGrossTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementDeductibleTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementDeductibleTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementDepreciationTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementDepreciationTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementDiscount;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementDiscount;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementCustomerPay;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementCustomerPay;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementInsurancePay;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementInsurancePay;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementDeposit;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementDeposit;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? SupplementAmountDue;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? SupplementAmountDue;
|
||||
|
||||
[FieldFixedLength(5)]
|
||||
public Double? RevisedTotalsBodyHours;
|
||||
public Decimal? RevisedTotalsBodyHours;
|
||||
|
||||
[FieldFixedLength(5)]
|
||||
public Double? RevisedTotalsRefinishHours;
|
||||
public Decimal? RevisedTotalsRefinishHours;
|
||||
[FieldFixedLength(5)]
|
||||
public Double? RevisedTotalsMechanicalHours;
|
||||
public Decimal? RevisedTotalsMechanicalHours;
|
||||
[FieldFixedLength(5)]
|
||||
public Double? RevisedTotalsStructuralHours;
|
||||
public Decimal? RevisedTotalsStructuralHours;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsPartsTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsPartsTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsSubletTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsSubletTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsBodyLaborTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsBodyLaborTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsRefinishLaborTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsRefinishLaborTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsMechanicalLaborTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsMechanicalLaborTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsStructuralLaborTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsStructuralLaborTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsMiscellaneousChargeTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsMiscellaneousChargeTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsPMTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsPMTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsBMTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsBMTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsMiscTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsMiscTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsTowingTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsTowingTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsStorageTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsStorageTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsDetailTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsDetailTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsSalesTaxTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsSalesTaxTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsGrossTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsGrossTotal;
|
||||
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsDeductibleTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsDeductibleTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsDepreciationTotal;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsDepreciationTotal;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsDiscount;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsDiscount;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsCustomerPay;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsCustomerPay;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsInsurancePay;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsInsurancePay;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsDeposit;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsDeposit;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? RevisedTotalsAmountDue;
|
||||
[FieldConverter(typeof(MoneyConverter))]
|
||||
public Decimal? RevisedTotalsAmountDue;
|
||||
|
||||
[FieldFixedLength(2)]
|
||||
public int ProductionStatus;
|
||||
@@ -382,11 +437,11 @@ namespace BodyshopPartner.Utils
|
||||
[FieldFixedLength(50)]
|
||||
public String InScreenCommentsLine2;
|
||||
[FieldFixedLength(4)]
|
||||
public int CustomerPhone2Extension;
|
||||
public string CustomerPhone2Extension;
|
||||
[FieldFixedLength(10)]
|
||||
public int CustomerPhone3;
|
||||
public String CustomerPhone3;
|
||||
[FieldFixedLength(4)]
|
||||
public int CustomerPhone3Extension;
|
||||
public string CustomerPhone3Extension;
|
||||
[FieldFixedLength(60)]
|
||||
public String CustomerFileComments;
|
||||
[FieldFixedLength(10)]
|
||||
@@ -422,7 +477,7 @@ namespace BodyshopPartner.Utils
|
||||
[FieldFixedLength(80)]
|
||||
public String CustomerEmail;
|
||||
[FieldFixedLength(12)]
|
||||
public Double? GSTTax;
|
||||
public Decimal? GSTTax;
|
||||
[FieldFixedLength(3)]
|
||||
public String RepairDelayStatusCode;
|
||||
[FieldFixedLength(80)]
|
||||
@@ -443,3 +498,21 @@ namespace BodyshopPartner.Utils
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class MoneyConverter : ConverterBase
|
||||
{
|
||||
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
|
||||
public override object StringToField(string from)
|
||||
{
|
||||
return Convert.ToDecimal(Decimal.Parse(from) / 100);
|
||||
}
|
||||
|
||||
public override string FieldToString(object fieldValue)
|
||||
{
|
||||
|
||||
if (fieldValue == null) return "";
|
||||
return ((Decimal)(fieldValue ?? 0)).ToString("#.##");
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,39 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Win32.TaskScheduler;
|
||||
|
||||
|
||||
namespace BodyshopPartner.Utils
|
||||
{
|
||||
public static class PaintScaleConfig
|
||||
{
|
||||
private static string workingDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
|
||||
public static void RegisterScheduledTask()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Microsoft.Win32.TaskScheduler.Task existingTask = TaskService.Instance.FindTask("ImEX Online Partner - Paint Scale Connection");
|
||||
if(existingTask != null)
|
||||
{
|
||||
TaskService.Instance.RootFolder.DeleteTask("ImEX Online Partner - Paint Scale Connection");
|
||||
}
|
||||
Microsoft.Win32.TaskScheduler.Task newTask = TaskService.Instance.AddTask("ImEX Online Partner - Paint Scale Connection", QuickTriggerType.Hourly, "powershell.exe", @"-ExecutionPolicy Bypass -File " + workingDirectory + @"\Utils\Scripts\PaintScaleExport.ps1");
|
||||
newTask.Run();
|
||||
|
||||
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
logger.Error(ex, "Error when trying to register scheduled task.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
61
BodyshopUploader/Utils/ScheduledTaskConfig.cs
Normal file
61
BodyshopUploader/Utils/ScheduledTaskConfig.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Win32.TaskScheduler;
|
||||
|
||||
|
||||
namespace BodyshopPartner.Utils
|
||||
{
|
||||
public static class ScheduledTaskConfig
|
||||
{
|
||||
private static string workingDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
|
||||
public static void RegisterPaintScale()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Microsoft.Win32.TaskScheduler.Task existingTask = TaskService.Instance.FindTask("ImEX Online Partner - Paint Scale Connection");
|
||||
if (existingTask != null)
|
||||
{
|
||||
TaskService.Instance.RootFolder.DeleteTask("ImEX Online Partner - Paint Scale Connection");
|
||||
}
|
||||
Microsoft.Win32.TaskScheduler.Task newTask = TaskService.Instance.AddTask("ImEX Online Partner - Paint Scale Connection", QuickTriggerType.Hourly, "powershell.exe", @"-ExecutionPolicy Bypass -File " + workingDirectory + @"\Utils\Scripts\PaintScaleExport.ps1");
|
||||
newTask.Run();
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(ex, "Error when trying to register scheduled task.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void RegisterArms()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Microsoft.Win32.TaskScheduler.Task existingTask = TaskService.Instance.FindTask("ImEX Online Partner - ARMS");
|
||||
if (existingTask != null)
|
||||
{
|
||||
TaskService.Instance.RootFolder.DeleteTask("ImEX Online Partner - ARMS");
|
||||
}
|
||||
Microsoft.Win32.TaskScheduler.Task newTask = TaskService.Instance.AddTask("ImEX Online Partner - ARMS", QuickTriggerType.Daily, "powershell.exe", @"-ExecutionPolicy Bypass -File " + workingDirectory + @"\Utils\Scripts\ArmsExport.ps1");
|
||||
newTask.Run();
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(ex, "Error when trying to register scheduled task.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
38
BodyshopUploader/Utils/Scripts/ArmsExport.ps1
Normal file
38
BodyshopUploader/Utils/Scripts/ArmsExport.ps1
Normal file
@@ -0,0 +1,38 @@
|
||||
#Verify that the partner is running. If not, strat it.
|
||||
|
||||
if((Get-Process -Name ImEXOnlinePartner -ErrorAction SilentlyContinue) -eq $null){
|
||||
& "$Env:USERPROFILE\AppData\Local\ImEXOnlinePartner\ImEXOnlinePartner.exe"
|
||||
}
|
||||
|
||||
$PSversion = $PSVersionTable.PSVersion.Major
|
||||
|
||||
|
||||
function v2 {
|
||||
# Post request to the partner to trigger the export.
|
||||
Invoke-WebRequest -Uri http://localhost:1337/arms/rodata/ -Method POST
|
||||
#Start the Arms Uploader.
|
||||
#Start-Process -FilePath "C:\ImEX\Applications\ARMSUploader\ROUpload.exe"
|
||||
}
|
||||
|
||||
function v1 {
|
||||
WebRequest = [System.Net.WebRequest]::Create("http://localhost:1337/arms/rodata/")
|
||||
WebRequest.Method = "POST"
|
||||
WebRequest.ContentType = "application/json"
|
||||
Response = $WebRequest.GetResponse()
|
||||
ResponseStream = $Response.GetResponseStream()
|
||||
ReadStream = New-Object System.IO.StreamReader $ResponseStream
|
||||
#Data=$ReadStream.ReadToEnd()
|
||||
#Start the Arms Uploader.
|
||||
Start-Process -FilePath "C:\ImEX\Applications\ARMSUploader\ROUpload.exe"
|
||||
}
|
||||
|
||||
|
||||
Switch ($PSversion) {
|
||||
1 {v1}
|
||||
2 {v1}
|
||||
4 {v2}
|
||||
5 {v2}
|
||||
6 {v2}
|
||||
7 {v2}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace BodyshopPartner.Utils
|
||||
mgr.CreateShortcutForThisExe();
|
||||
Utils.UpdateHandler.RestoreSettings();
|
||||
Utils.UpdateHandler.ToggleStartWithWindows(Properties.Settings.Default.StartWithWindows);
|
||||
Utils.PaintScaleConfig.RegisterScheduledTask();
|
||||
Utils.ScheduledTaskConfig.RegisterPaintScale();
|
||||
},
|
||||
onAppUninstall: v =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user