Exemple #1
0
        static List <TaxSumm> GetSubCNTaxSumm(Item[] itemcodes, List <CNNoteDtls> invs)
        {
            List <TaxSumm> summ = new List <TaxSumm>();
            var            grp  = from p in invs
                                  group p by p.taxgrp into g
                                  select new { taxgrp = g.Key, ttltax = g.Sum(x => x.tax), ttlAmt = g.Sum(v => v.netamount) };

            foreach (var g in grp)
            {
                TaxSumm tsumm = new TaxSumm();
                var     list3 = itemcodes.Where(x => x.taxgrp == g.taxgrp).ToList();
                if (list3.Count > 0)
                {
                    tsumm.TaxDesc = g.taxgrp.Trim() + " @ " + list3[0].tax.ToString() + "%";
                }
                else
                {
                    tsumm.TaxDesc = g.taxgrp.Trim();
                }
                tsumm.TaxAmt = g.ttltax;
                tsumm.Amount = g.ttlAmt;
                tsumm.TaxGrp = g.taxgrp;
                summ.Add(tsumm);
            }

            return(summ);
        }
Exemple #2
0
//		private static double GetCNSumTotal (CNNote[] invs,string trxtype)
//		{
//			double total = 0;
//			var sum1 = from p in invs
//					where p.trxtype == trxtype
//				group p by 1 into g
//				select new {
//				amt = g.Sum (x => x.amount),
//				tax = g.Sum (x => x.taxamt)
//			};
//
//			if (sum1.Count() >0)
//				total = sum1.FirstOrDefault().amt + sum1.FirstOrDefault().tax;
//
//			return total;
//		}

        static List <TaxSumm> GeTotalTaxSumm(List <TaxSumm> summ, List <TaxSumm> source)
        {
            foreach (var itm in source)
            {
                if (summ.Where(x => x.TaxGrp == itm.TaxGrp).Count() == 0)
                {
                    TaxSumm s = new TaxSumm();
                    s.TaxGrp  = itm.TaxGrp;
                    s.Amount  = itm.Amount;
                    s.TaxAmt  = itm.TaxAmt;
                    s.TaxDesc = itm.TaxDesc;
                    summ.Add(s);
                }
                else
                {
                    var taxsum = summ.Where(x => x.TaxGrp == itm.TaxGrp).FirstOrDefault();
                    taxsum.Amount = taxsum.Amount + itm.Amount;
                    taxsum.TaxAmt = taxsum.TaxAmt + itm.TaxAmt;
                }
            }

            return(summ);
        }
Exemple #3
0
        static List<TaxSumm> GetSubTaxSumm(Item[] itemcodes, List<InvoiceDtls> invs)
        {
            List<TaxSumm> summ = new List<TaxSumm>();
            var grp = from p in invs
                group p by p.taxgrp into g
                select new { taxgrp = g.Key, ttltax = g.Sum(x => x.tax), ttlAmt = g.Sum(v => v.netamount) };
            foreach (var g in grp)
            {
                TaxSumm tsumm = new TaxSumm();
                var list3 = itemcodes.Where(x => x.taxgrp == g.taxgrp).ToList();
                if (list3.Count > 0)
                {

                    tsumm.TaxDesc = g.taxgrp.Trim() + " @ " + list3[0].tax.ToString() + "%";
                }
                else tsumm.TaxDesc= g.taxgrp.Trim();
                tsumm.TaxAmt = g.ttltax;
                tsumm.Amount = g.ttlAmt;
                tsumm.TaxGrp = g.taxgrp;
                summ.Add(tsumm);
            }

            return summ;
        }
Exemple #4
0
        //        private static double GetCNSumTotal (CNNote[] invs,string trxtype)
        //        {
        //            double total = 0;
        //            var sum1 = from p in invs
        //                    where p.trxtype == trxtype
        //                group p by 1 into g
        //                select new {
        //                amt = g.Sum (x => x.amount),
        //                tax = g.Sum (x => x.taxamt)
        //            };
        //
        //            if (sum1.Count() >0)
        //                total = sum1.FirstOrDefault().amt + sum1.FirstOrDefault().tax;
        //
        //            return total;
        //        }
        static List<TaxSumm> GeTotalTaxSumm(List<TaxSumm> summ,List<TaxSumm> source)
        {
            foreach (var itm in source)
            {
                if (summ.Where(x => x.TaxGrp == itm.TaxGrp).Count() == 0)
                {
                    TaxSumm s = new TaxSumm();
                    s.TaxGrp = itm.TaxGrp;
                    s.Amount = itm.Amount;
                    s.TaxAmt =  itm.TaxAmt;
                    s.TaxDesc = itm.TaxDesc;
                    summ.Add(s);
                }
                else
                {
                    var taxsum =summ.Where(x => x.TaxGrp == itm.TaxGrp).FirstOrDefault();
                    taxsum.Amount = taxsum.Amount + itm.Amount;
                    taxsum.TaxAmt = taxsum.TaxAmt + itm.TaxAmt;
                }
            }

            return summ;
        }