private PLRTaxes GetTaxes(int ContactId) { PLRTaxes plrTaxes = new PLRTaxes(); try { int?RegionId = (from c in _context.CLA_Workshops_VW where c.ContactId == ContactId select c.TaxRegion_Id).FirstOrDefault(); string IsCompany = (from c in _context.CLA_Workshops_VW where c.ContactId == ContactId select c.isCompany).FirstOrDefault(); SLS_CheckFBRList_Claim_SP_Result Filer = _context.SLS_CheckFBRList_Claim_SP(ContactId).FirstOrDefault(); List <Surveyor_SalesTax_Result> Tax = _context.Surveyor_SalesTax(RegionId).ToList(); if (Filer != null && IsCompany == "Y") { List <Surveyor_SalesTax_Result> _res = Tax.Where(x => x.Name.Contains("WH_Labor_NTN_C") || x.Name.Contains("WH_Part_NTN_C") || x.Name.Contains("GST on Labour") || x.Name.Contains("WTax on GST Labor")).ToList(); plrTaxes.GstLaborRate = _res.Where(x => x.TaxName == "Lab_Reg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_Reg_Gst_RTU").FirstOrDefault().TaxPercentage; plrTaxes.GstLaborTaxId = _res.Where(x => x.TaxName == "Lab_Reg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_Reg_Gst_RTU").FirstOrDefault().TaxId; plrTaxes.GstLaborTaxPercentageId = _res.Where(x => x.TaxName == "Lab_Reg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_Reg_Gst_RTU").FirstOrDefault().TaxPercentageId; plrTaxes.WHPartRate = Tax.Where(x => x.Name == "WH_Part_NTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_NTN_C").FirstOrDefault().TaxPercentage; plrTaxes.WHTaxPartTaxId = Tax.Where(x => x.Name == "WH_Part_NTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_NTN_C").FirstOrDefault().TaxId; plrTaxes.WHPartTaxPercentageId = Tax.Where(x => x.Name == "WH_Part_NTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_NTN_C").FirstOrDefault().TaxPercentageId; plrTaxes.WHLaborRate = Tax.Where(x => x.Name == "WH_Labor_NTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_NTN_C").FirstOrDefault().TaxPercentage; plrTaxes.WHTaxLaborTaxId = Tax.Where(x => x.Name == "WH_Labor_NTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_NTN_C").FirstOrDefault().TaxId; plrTaxes.WHTaxLaborPercentageId = Tax.Where(x => x.Name == "WH_Labor_NTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_NTN_C").FirstOrDefault().TaxPercentageId; plrTaxes.GstWHLaborRate = Tax.Where(x => x.TaxName == "Lab_Reg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_Reg_GstWH_RTU").FirstOrDefault().TaxPercentage; plrTaxes.GstWHLaborTaxId = Tax.Where(x => x.TaxName == "Lab_Reg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_Reg_GstWH_RTU").FirstOrDefault().TaxId; plrTaxes.GstWHLaborTaxPercentageId = Tax.Where(x => x.TaxName == "Lab_Reg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_Reg_GstWH_RTU").FirstOrDefault().TaxPercentageId; } else if (Filer != null && IsCompany == "N") { List <Surveyor_SalesTax_Result> _res = Tax.Where(x => x.Name.Contains("WH_Labor_NTN_NC") || x.Name.Contains("WH_Part_NTN_NC") || x.Name.Contains("GST on Labour") || x.Name.Contains("WTax on GST Labor")).ToList(); plrTaxes.GstLaborRate = _res.Where(x => x.TaxName == "Lab_Reg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_Reg_Gst").FirstOrDefault().TaxPercentage; plrTaxes.GstLaborTaxId = _res.Where(x => x.TaxName == "Lab_Reg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_Reg_Gst").FirstOrDefault().TaxId; plrTaxes.GstLaborTaxPercentageId = _res.Where(x => x.TaxName == "Lab_Reg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_Reg_Gst").FirstOrDefault().TaxPercentageId; plrTaxes.WHPartRate = Tax.Where(x => x.Name == "WH_Part_NTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_NTN_NC").FirstOrDefault().TaxPercentage; plrTaxes.WHTaxPartTaxId = Tax.Where(x => x.Name == "WH_Part_NTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_NTN_NC").FirstOrDefault().TaxId; plrTaxes.WHPartTaxPercentageId = Tax.Where(x => x.Name == "WH_Part_NTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_NTN_NC").FirstOrDefault().TaxPercentageId; plrTaxes.WHLaborRate = Tax.Where(x => x.Name == "WH_Labor_NTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_NTN_NC").FirstOrDefault().TaxPercentage; plrTaxes.WHTaxLaborTaxId = Tax.Where(x => x.Name == "WH_Labor_NTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_NTN_NC").FirstOrDefault().TaxId; plrTaxes.WHTaxLaborPercentageId = Tax.Where(x => x.Name == "WH_Labor_NTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_NTN_NC").FirstOrDefault().TaxPercentageId; plrTaxes.GstWHLaborRate = Tax.Where(x => x.TaxName == "Lab_Reg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_Reg_GstWH").FirstOrDefault().TaxPercentage; plrTaxes.GstWHLaborTaxId = Tax.Where(x => x.TaxName == "Lab_Reg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_Reg_GstWH").FirstOrDefault().TaxId; plrTaxes.GstWHLaborTaxPercentageId = Tax.Where(x => x.TaxName == "Lab_Reg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_Reg_GstWH").FirstOrDefault().TaxPercentageId; } else if (Filer == null && IsCompany == "Y") { List <Surveyor_SalesTax_Result> _res = Tax.Where(x => x.Name.Contains("WH_Labor_woNTN_C") || x.Name.Contains("WH_Part_woNTN_C") || x.Name.Contains("GST on Labour") || x.Name.Contains("WTax on GST Labor")).ToList(); plrTaxes.GstLaborRate = _res.Where(x => x.TaxName == "Lab_UnReg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_UnReg_Gst_RTU").FirstOrDefault().TaxPercentage; plrTaxes.GstLaborTaxId = _res.Where(x => x.TaxName == "Lab_UnReg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_UnReg_Gst_RTU").FirstOrDefault().TaxId; plrTaxes.GstLaborTaxPercentageId = _res.Where(x => x.TaxName == "Lab_UnReg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_UnReg_Gst_RTU").FirstOrDefault().TaxPercentageId; plrTaxes.WHPartRate = Tax.Where(x => x.Name == "WH_Part_woNTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_woNTN_C").FirstOrDefault().TaxPercentage; plrTaxes.WHTaxPartTaxId = Tax.Where(x => x.Name == "WH_woPart_woNTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_woNTN_C").FirstOrDefault().TaxId; plrTaxes.WHPartTaxPercentageId = Tax.Where(x => x.Name == "WH_Part_woNTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_woNTN_C").FirstOrDefault().TaxPercentageId; plrTaxes.WHLaborRate = Tax.Where(x => x.Name == "WH_Labor_woNTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_woNTN_C").FirstOrDefault().TaxPercentage; plrTaxes.WHTaxLaborTaxId = Tax.Where(x => x.Name == "WH_Labor_woNTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_woNTN_C").FirstOrDefault().TaxId; plrTaxes.WHTaxLaborPercentageId = Tax.Where(x => x.Name == "WH_Labor_woNTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_woNTN_C").FirstOrDefault().TaxPercentageId; plrTaxes.GstWHLaborRate = Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH_RTU").FirstOrDefault().TaxPercentage; plrTaxes.GstWHLaborTaxId = Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH_RTU").FirstOrDefault().TaxId; plrTaxes.GstWHLaborTaxPercentageId = Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH_RTU").FirstOrDefault().TaxPercentageId; } else if (Filer == null && IsCompany == "N") { List <Surveyor_SalesTax_Result> _res = Tax.Where(x => x.Name.Contains("WH_Labor_woNTN_NC") || x.Name.Contains("WH_Part_woNTN_NC") || x.Name.Contains("GST on Labour") || x.Name.Contains("WTax on GST Labor")).ToList(); plrTaxes.GstLaborRate = _res.Where(x => x.TaxName == "Lab_UnReg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_UnReg_Gst").FirstOrDefault().TaxPercentage; plrTaxes.GstLaborTaxId = _res.Where(x => x.TaxName == "Lab_UnReg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_UnReg_Gst").FirstOrDefault().TaxId; plrTaxes.GstLaborTaxPercentageId = _res.Where(x => x.TaxName == "Lab_UnReg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_UnReg_Gst").FirstOrDefault().TaxPercentageId; plrTaxes.WHPartRate = Tax.Where(x => x.Name == "WH_Part_woNTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_woNTN_NC").FirstOrDefault().TaxPercentage; plrTaxes.WHTaxPartTaxId = Tax.Where(x => x.Name == "WH_Part_woNTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_woNTN_NC").FirstOrDefault().TaxId; plrTaxes.WHPartTaxPercentageId = Tax.Where(x => x.Name == "WH_Part_woNTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_woNTN_NC").FirstOrDefault().TaxPercentageId; plrTaxes.WHLaborRate = Tax.Where(x => x.Name == "WH_Labor_woNTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_woNTN_NC").FirstOrDefault().TaxPercentage; plrTaxes.WHTaxLaborTaxId = Tax.Where(x => x.Name == "WH_Labor_woNTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_woNTN_NC").FirstOrDefault().TaxId; plrTaxes.WHTaxLaborPercentageId = Tax.Where(x => x.Name == "WH_Labor_woNTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_woNTN_NC").FirstOrDefault().TaxPercentageId; plrTaxes.GstWHLaborRate = Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH").FirstOrDefault().TaxPercentage; plrTaxes.GstWHLaborTaxId = Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH").FirstOrDefault().TaxId; plrTaxes.GstWHLaborTaxPercentageId = Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH").FirstOrDefault().TaxPercentageId; } } catch (Exception ex) { LoggerService.LogExceptionsToDebugConsole(ex); } return(plrTaxes); }
public Taxes GetTaxesPLRParties(int?PartiesId, int _ContactId, DateTime InvoiceDate) { Taxes cl = new Taxes(); if (PartyId != PartiesId && VendorId != _ContactId) { PartyId = PartiesId; VendorId = _ContactId; using (Entities obj = new Entities()) { var TaxProfileObj = obj.CLA_WorkShop_TaxSetup_TB.Where(x => x.ContactId == _ContactId && x.Active == Status.Active).FirstOrDefault(); var _RegionId = (from c in obj.CLA_PLRParties_TB where c.Id == PartiesId select c.TaxRegion_Id).FirstOrDefault(); int?RegionId = TaxProfileObj == null ? _RegionId : TaxProfileObj.TaxRegionId != 0 ? TaxProfileObj.TaxRegionId : _RegionId; var _IsCompany = (from c in obj.CLA_PLRParties_TB where c.Id == PartiesId select c.IsCompany).FirstOrDefault(); string IsCompany = TaxProfileObj == null ? _IsCompany : TaxProfileObj.IsCompany != null ? TaxProfileObj.IsCompany : _IsCompany; int?ContactId = (from p in obj.CLA_PLRParties_TB join r in obj.SLS_ContactRelation_TB on p.Id equals r.Transaction_Id where ((p.PartyType_Id == (int)PartyType.Supplier && r.TransactionType_Id == (int)TransactionType.Supplier) || (p.PartyType_Id == (int)PartyType.Workshop && r.TransactionType_Id == (int)TransactionType.Workshop)) && r.RelationType_Id == (int)RelationType.PLR && p.Id == PartiesId select r.Contact_Id).FirstOrDefault(); var _IsWHTaxExempted = (from p in obj.CLA_PLRParties_TB join r in obj.SLS_ContactRelation_TB on p.Id equals r.Transaction_Id where ((p.PartyType_Id == (int)PartyType.Supplier && r.TransactionType_Id == (int)TransactionType.Supplier) || (p.PartyType_Id == (int)PartyType.Workshop && r.TransactionType_Id == (int)TransactionType.Workshop)) && r.RelationType_Id == (int)RelationType.PLR && p.Id == PartiesId select p.IsWHTaxExempted).FirstOrDefault() == "Y" ? true : false; var IsWHTaxExempted = TaxProfileObj == null ? _IsWHTaxExempted : TaxProfileObj.IsWHTaxExempted != null ? (TaxProfileObj.IsWHTaxExempted == "Y" ? true : false) : _IsWHTaxExempted; var _IsTaxExempted = (from p in obj.CLA_PLRParties_TB join r in obj.SLS_ContactRelation_TB on p.Id equals r.Transaction_Id where ((p.PartyType_Id == (int)PartyType.Supplier && r.TransactionType_Id == (int)TransactionType.Supplier) || (p.PartyType_Id == (int)PartyType.Workshop && r.TransactionType_Id == (int)TransactionType.Workshop)) && r.RelationType_Id == (int)RelationType.PLR && p.Id == PartiesId select p.IsTaxExempted).FirstOrDefault() == "Y" ? true : false; var IsTaxExempted = TaxProfileObj == null ? _IsTaxExempted : TaxProfileObj.IsTaxExempted != null ? (TaxProfileObj.IsTaxExempted == "Y" ? true : false) : _IsTaxExempted; var _IsImported = (from p in obj.CLA_PLRParties_TB join r in obj.SLS_ContactRelation_TB on p.Id equals r.Transaction_Id where ((p.PartyType_Id == (int)PartyType.Supplier && r.TransactionType_Id == (int)TransactionType.Supplier) || (p.PartyType_Id == (int)PartyType.Workshop && r.TransactionType_Id == (int)TransactionType.Workshop)) && r.RelationType_Id == (int)RelationType.PLR && p.Id == PartiesId select p.IsImportedPart).FirstOrDefault(); var IsImported = TaxProfileObj == null ? _IsImported : TaxProfileObj.IsImportedPart != null ? TaxProfileObj.IsImportedPart : _IsImported; cl.IsImported = IsImported; cl.IsWHTaxExempted = IsWHTaxExempted; cl.IsTaxExempted = IsTaxExempted; InvoiceDate = DateTime.Now; SLS_CheckFBRList_Claim_SP_Result Filer = obj.SLS_CheckFBRList_Claim_SP(ContactId).FirstOrDefault(); List <Surp_Surveyor_SalesTax_Result> Tax = obj.Surp_Surveyor_SalesTax(RegionId, InvoiceDate).ToList(); if (Filer != null && IsCompany == "Y") { List <Surp_Surveyor_SalesTax_Result> _res = Tax.Where(x => x.Name.Contains("WH_Labor_NTN_C") || x.Name.Contains("WH_Part_NTN_C") || x.Name.Contains("GST on Labour") || x.Name.Contains("WTax on GST Labor")).ToList(); cl.GstLaborRate = _res.Where(x => x.TaxName == "Lab_Reg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_Reg_Gst_RTU").FirstOrDefault().TaxPercentage; cl.GstLaborTaxId = _res.Where(x => x.TaxName == "Lab_Reg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_Reg_Gst_RTU").FirstOrDefault().TaxId; cl.GstLaborTaxPercentageId = _res.Where(x => x.TaxName == "Lab_Reg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_Reg_Gst_RTU").FirstOrDefault().TaxPercentageId; cl.WHPartRate = Tax.Where(x => x.Name == "WH_Part_NTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_NTN_C").FirstOrDefault().TaxPercentage; cl.WHTaxPartTaxId = Tax.Where(x => x.Name == "WH_Part_NTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_NTN_C").FirstOrDefault().TaxId; cl.WHPartTaxPercentageId = Tax.Where(x => x.Name == "WH_Part_NTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_NTN_C").FirstOrDefault().TaxPercentageId; cl.WHLaborRate = Tax.Where(x => x.Name == "WH_Labor_NTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_NTN_C").FirstOrDefault().TaxPercentage; cl.WHTaxLaborTaxId = Tax.Where(x => x.Name == "WH_Labor_NTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_NTN_C").FirstOrDefault().TaxId; cl.WHTaxLaborPercentageId = Tax.Where(x => x.Name == "WH_Labor_NTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_NTN_C").FirstOrDefault().TaxPercentageId; cl.GstWHLaborRate = Tax.Where(x => x.TaxName == "Lab_Reg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_Reg_GstWH_RTU").FirstOrDefault().TaxPercentage; cl.GstWHLaborTaxId = Tax.Where(x => x.TaxName == "Lab_Reg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_Reg_GstWH_RTU").FirstOrDefault().TaxId; cl.GstWHLaborTaxPercentageId = Tax.Where(x => x.TaxName == "Lab_Reg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_Reg_GstWH_RTU").FirstOrDefault().TaxPercentageId; cl.GstWHPartRate = Tax.Where(x => x.TaxName == "Part_Reg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Part_Reg_GstWH_RTU").FirstOrDefault().TaxPercentage; cl.GstWHPartTaxId = Tax.Where(x => x.TaxName == "Part_Reg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Part_Reg_GstWH_RTU").FirstOrDefault().TaxId; cl.GstWHPartTaxPercentageId = Tax.Where(x => x.TaxName == "Part_Reg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Part_Reg_GstWH_RTU").FirstOrDefault().TaxPercentageId; cl.GstPartRate = _res.Where(x => x.TaxName == "Part_Reg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Part_Reg_Gst_RTU").FirstOrDefault().TaxPercentage; cl.GstPartTaxId = _res.Where(x => x.TaxName == "Part_Reg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Part_Reg_Gst_RTU").FirstOrDefault().TaxId; cl.GstPartTaxPercentageId = _res.Where(x => x.TaxName == "Part_Reg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Part_Reg_Gst_RTU").FirstOrDefault().TaxPercentageId; } else if (Filer != null && IsCompany == "N") { List <Surp_Surveyor_SalesTax_Result> _res = Tax.Where(x => x.Name.Contains("WH_Labor_NTN_NC") || x.Name.Contains("WH_Part_NTN_NC") || x.Name.Contains("GST on Labour") || x.Name.Contains("WTax on GST Labor")).ToList(); cl.GstLaborRate = _res.Where(x => x.TaxName == "Lab_Reg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_Reg_Gst").FirstOrDefault().TaxPercentage; cl.GstLaborTaxId = _res.Where(x => x.TaxName == "Lab_Reg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_Reg_Gst").FirstOrDefault().TaxId; cl.GstLaborTaxPercentageId = _res.Where(x => x.TaxName == "Lab_Reg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_Reg_Gst").FirstOrDefault().TaxPercentageId; cl.WHPartRate = Tax.Where(x => x.Name == "WH_Part_NTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_NTN_NC").FirstOrDefault().TaxPercentage; cl.WHTaxPartTaxId = Tax.Where(x => x.Name == "WH_Part_NTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_NTN_NC").FirstOrDefault().TaxId; cl.WHPartTaxPercentageId = Tax.Where(x => x.Name == "WH_Part_NTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_NTN_NC").FirstOrDefault().TaxPercentageId; cl.WHLaborRate = Tax.Where(x => x.Name == "WH_Labor_NTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_NTN_NC").FirstOrDefault().TaxPercentage; cl.WHTaxLaborTaxId = Tax.Where(x => x.Name == "WH_Labor_NTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_NTN_NC").FirstOrDefault().TaxId; cl.WHTaxLaborPercentageId = Tax.Where(x => x.Name == "WH_Labor_NTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_NTN_NC").FirstOrDefault().TaxPercentageId; cl.GstWHLaborRate = Tax.Where(x => x.TaxName == "Lab_Reg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_Reg_GstWH").FirstOrDefault().TaxPercentage; cl.GstWHLaborTaxId = Tax.Where(x => x.TaxName == "Lab_Reg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_Reg_GstWH").FirstOrDefault().TaxId; cl.GstWHLaborTaxPercentageId = Tax.Where(x => x.TaxName == "Lab_Reg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_Reg_GstWH").FirstOrDefault().TaxPercentageId; cl.GstWHPartRate = Tax.Where(x => x.TaxName == "Part_Reg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Part_Reg_GstWH").FirstOrDefault().TaxPercentage; cl.GstWHPartTaxId = Tax.Where(x => x.TaxName == "Part_Reg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Part_Reg_GstWH").FirstOrDefault().TaxId; cl.GstWHPartTaxPercentageId = Tax.Where(x => x.TaxName == "Part_Reg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Part_Reg_GstWH").FirstOrDefault().TaxPercentageId; cl.GstPartRate = _res.Where(x => x.TaxName == "Part_Reg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Part_Reg_Gst").FirstOrDefault().TaxPercentage; cl.GstPartTaxId = _res.Where(x => x.TaxName == "Part_Reg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Part_Reg_Gst").FirstOrDefault().TaxId; cl.GstPartTaxPercentageId = _res.Where(x => x.TaxName == "Part_Reg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Part_Reg_Gst").FirstOrDefault().TaxPercentageId; } else if (Filer == null && IsCompany == "Y") { List <Surp_Surveyor_SalesTax_Result> _res = Tax.Where(x => x.Name.Contains("WH_Labor_woNTN_C") || x.Name.Contains("WH_Part_woNTN_C") || x.Name.Contains("GST on Labour") || x.Name.Contains("WTax on GST Labor")).ToList(); cl.GstLaborRate = _res.Where(x => x.TaxName == "Lab_UnReg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_UnReg_Gst_RTU").FirstOrDefault().TaxPercentage; cl.GstLaborTaxId = _res.Where(x => x.TaxName == "Lab_UnReg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_UnReg_Gst_RTU").FirstOrDefault().TaxId; cl.GstLaborTaxPercentageId = _res.Where(x => x.TaxName == "Lab_UnReg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_UnReg_Gst_RTU").FirstOrDefault().TaxPercentageId; cl.WHPartRate = Tax.Where(x => x.Name == "WH_Part_woNTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_woNTN_C").FirstOrDefault().TaxPercentage; cl.WHTaxPartTaxId = Tax.Where(x => x.Name == "WH_woPart_woNTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_woNTN_C").FirstOrDefault().TaxId; cl.WHPartTaxPercentageId = Tax.Where(x => x.Name == "WH_Part_woNTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_woNTN_C").FirstOrDefault().TaxPercentageId; cl.WHLaborRate = Tax.Where(x => x.Name == "WH_Labor_woNTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_woNTN_C").FirstOrDefault().TaxPercentage; cl.WHTaxLaborTaxId = Tax.Where(x => x.Name == "WH_Labor_woNTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_woNTN_C").FirstOrDefault().TaxId; cl.WHTaxLaborPercentageId = Tax.Where(x => x.Name == "WH_Labor_woNTN_C").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_woNTN_C").FirstOrDefault().TaxPercentageId; cl.GstWHLaborRate = Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH_RTU").FirstOrDefault().TaxPercentage; cl.GstWHLaborTaxId = Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH_RTU").FirstOrDefault().TaxId; cl.GstWHLaborTaxPercentageId = Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH_RTU").FirstOrDefault().TaxPercentageId; cl.GstWHPartRate = Tax.Where(x => x.TaxName == "Part_UnReg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Part_UnReg_GstWH_RTU").FirstOrDefault().TaxPercentage; cl.GstWHPartTaxId = Tax.Where(x => x.TaxName == "Part_UnReg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Part_UnReg_GstWH_RTU").FirstOrDefault().TaxId; cl.GstWHPartTaxPercentageId = Tax.Where(x => x.TaxName == "Part_UnReg_GstWH_RTU").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Part_UnReg_GstWH_RTU").FirstOrDefault().TaxPercentageId; cl.GstPartRate = _res.Where(x => x.TaxName == "Part_UnReg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Part_UnReg_Gst_RTU").FirstOrDefault().TaxPercentage; cl.GstPartTaxId = _res.Where(x => x.TaxName == "Part_UnReg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Part_UnReg_Gst_RTU").FirstOrDefault().TaxId; cl.GstPartTaxPercentageId = _res.Where(x => x.TaxName == "Part_UnReg_Gst_RTU").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Part_UnReg_Gst_RTU").FirstOrDefault().TaxPercentageId; } else if (Filer == null && IsCompany == "N") { List <Surp_Surveyor_SalesTax_Result> _res = Tax.Where(x => x.Name.Contains("WH_Labor_woNTN_NC") || x.Name.Contains("WH_Part_woNTN_NC") || x.Name.Contains("GST on Labour") || x.Name.Contains("WTax on GST Labor")).ToList(); cl.GstLaborRate = _res.Where(x => x.TaxName == "Lab_UnReg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_UnReg_Gst").FirstOrDefault().TaxPercentage; cl.GstLaborTaxId = _res.Where(x => x.TaxName == "Lab_UnReg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_UnReg_Gst").FirstOrDefault().TaxId; cl.GstLaborTaxPercentageId = _res.Where(x => x.TaxName == "Lab_UnReg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Lab_UnReg_Gst").FirstOrDefault().TaxPercentageId; cl.WHPartRate = Tax.Where(x => x.Name == "WH_Part_woNTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_woNTN_NC").FirstOrDefault().TaxPercentage; cl.WHTaxPartTaxId = Tax.Where(x => x.Name == "WH_Part_woNTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_woNTN_NC").FirstOrDefault().TaxId; cl.WHPartTaxPercentageId = Tax.Where(x => x.Name == "WH_Part_woNTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Part_woNTN_NC").FirstOrDefault().TaxPercentageId; cl.WHLaborRate = Tax.Where(x => x.Name == "WH_Labor_woNTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_woNTN_NC").FirstOrDefault().TaxPercentage; cl.WHTaxLaborTaxId = Tax.Where(x => x.Name == "WH_Labor_woNTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_woNTN_NC").FirstOrDefault().TaxId; cl.WHTaxLaborPercentageId = Tax.Where(x => x.Name == "WH_Labor_woNTN_NC").FirstOrDefault() == null ? 0 : Tax.Where(x => x.Name == "WH_Labor_woNTN_NC").FirstOrDefault().TaxPercentageId; cl.GstWHLaborRate = Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH").FirstOrDefault().TaxPercentage; cl.GstWHLaborTaxId = Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH").FirstOrDefault().TaxId; cl.GstWHLaborTaxPercentageId = Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Lab_UnReg_GstWH").FirstOrDefault().TaxPercentageId; cl.GstWHPartRate = Tax.Where(x => x.TaxName == "Part_UnReg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Part_UnReg_GstWH").FirstOrDefault().TaxPercentage; cl.GstWHPartTaxId = Tax.Where(x => x.TaxName == "Part_UnReg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Part_UnReg_GstWH").FirstOrDefault().TaxId; cl.GstWHPartTaxPercentageId = Tax.Where(x => x.TaxName == "Part_UnReg_GstWH").FirstOrDefault() == null ? 0 : Tax.Where(x => x.TaxName == "Part_UnReg_GstWH").FirstOrDefault().TaxPercentageId; cl.GstPartRate = _res.Where(x => x.TaxName == "Part_UnReg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Part_UnReg_Gst").FirstOrDefault().TaxPercentage; cl.GstPartTaxId = _res.Where(x => x.TaxName == "Part_UnReg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Part_UnReg_Gst").FirstOrDefault().TaxId; cl.GstPartTaxPercentageId = _res.Where(x => x.TaxName == "Part_UnReg_Gst").FirstOrDefault() == null ? 0 : _res.Where(x => x.TaxName == "Part_UnReg_Gst").FirstOrDefault().TaxPercentageId; } } Taxes = new Taxes(); Taxes = cl; } else { return(Taxes); } return(Taxes); }