예제 #1
0
        public List <PLRPartyItem> PartyitemTaxesMapping(int PlrPartyAmountId, int ContactId, List <PLRPartyItem> partitemlist)
        {
            PLRTaxes cl = GetTaxes(ContactId);
            Taxes    t  = new Taxes();

            foreach (PLRPartyItem item in partitemlist)
            {
                if (item.PLRPartyAmountId == PlrPartyAmountId)
                {
                    foreach (PLRPartyItemsTaxes i in item.PLRPartyItemsTaxesList)
                    {
                        if (item.ItemType == "L")
                        {
                            if (i.Tax_Id == cl.GstLaborTaxId)
                            {
                                i.Amount           = t.GstAmount(item.GrossAmount, Convert.ToDecimal(cl.GstLaborRate));
                                i.Tax_Id           = cl.GstLaborTaxId;
                                i.TaxPercentage_Id = cl.GstLaborTaxPercentageId;
                            }
                            else if (i.Tax_Id == cl.GstWHLaborTaxId)
                            {
                                i.Amount           = t.GstWHAmount(item.GrossAmount, Convert.ToDecimal(cl.GstLaborRate), Convert.ToDecimal(cl.GstWHLaborRate));
                                i.Tax_Id           = cl.GstWHLaborTaxId;
                                i.TaxPercentage_Id = cl.GstWHLaborTaxPercentageId;
                            }
                            else if (i.Tax_Id == cl.WHTaxLaborTaxId)
                            {
                                i.Amount           = t.WHTaxAmount(TypeConversionExtensions.GetNullableValue(item.Amount), Convert.ToDecimal(cl.WHLaborRate));
                                i.Tax_Id           = cl.WHTaxLaborTaxId;
                                i.TaxPercentage_Id = cl.WHTaxLaborPercentageId;
                            }
                        }
                        else
                        {
                            if (i.Tax_Id == cl.WHTaxPartTaxId)
                            {
                                i.Amount           = t.WHTaxAmount(TypeConversionExtensions.GetNullableValue(item.Amount), Convert.ToDecimal(cl.WHPartRate));
                                i.Tax_Id           = cl.WHTaxPartTaxId;
                                i.TaxPercentage_Id = cl.WHPartTaxPercentageId;
                            }
                        }
                    }
                }
            }

            return(partitemlist);
        }