//public OesoConfirmDialog(MainForm main_form, Oeso oeso, Armas armas, int? dealer_type) : this()
        //{
        //    this.main_form = main_form;
        //    this.oeso = oeso;
        //    this.armas = armas;
        //    this.dealer_type = dealer_type;
        //}

        public OesoConfirmDialog(MainForm main_form, Oeso oeso, List <Oesoit> oesoit, PopritVM poprit) : this()
        {
            this.main_form = main_form;
            this.oeso      = oeso;
            this.oesoit    = oesoit;
            this.poprit    = poprit;
            //this.armas = armas;
            //this.dealer_type = dealer_type;
        }
Exemple #2
0
        /** Convert poprit to print_model(PrintSoVM) **/
        public static PrintSoVM ToPrintModel(this PopritVM item)
        {
            if (item == null)
            {
                return(null);
            }

            PrintSoVM print_model = new PrintSoVM
            {
                Id            = item.Id,
                PoNum         = item.PoNum,
                PoDat         = item.PoDat,
                SoNum         = (item.SoNum != null ? item.SoNum.Substring(0, 12).Trim() : ""),
                SoDat         = item.SoDat,
                SeqNum        = (item.SoNum != null ? item.SoNum.Substring(13, 3).Trim() : ""),
                PrintSeq      = string.Empty,
                IvNum         = (item.IvNum != null ? item.IvNum : ""),
                IvDat         = item.IvDat,
                FlgVat        = item.FlgVat,
                DlvBy         = item.DlvBy,
                DlvDat1       = item.DlvDat1,
                DlvDat2       = item.DlvDat2,
                DealerCode    = item.DealerCode,
                DealerPrename = item.DealerPreName,
                DealerName    = item.DealerName,
                CustPrename   = item.cust.First().PreName,
                CustName      = item.cust.First().Name,
                CustTaxID     = item.cust.First().TaxId,
                CustAddr01    = item.cust.First().Addr01,
                CustAddr02    = item.cust.First().Addr02,
                CustAddr03    = item.cust.First().Addr03,
                CustZipCod    = item.cust.First().ZipCod,
                CustTelNum    = item.cust.First().TelNum,
                CustFaxNum    = item.cust.First().FaxNum,
                EmsTracking   = item.EmsTracking,
                SoBy_Id       = item.SoBy_Id,
                SoBy_Name     = item.SoBy_Name,
                IvBy_Id       = item.IvBy_Id,
                IvBy_Name     = item.IvBy_Name,
                RemarkPO      = item.Remark,
                RemarkSO      = item.SoRemark,
                RemarkIV      = item.IvRemark,

                StkCod    = item.StkCod,
                StkDes    = item.StkDes,
                OrdQty    = item.OrdQty,
                TquCod    = item.TquCod,
                UnitPrice = item.UnitPrice,
                DiscAmt   = item.DiscAmt,
                TrnVal    = item.TrnVal,
                VatAmt    = item.VatAmt,
                TaxAmt    = item.TaxAmt,
                NetAmt    = item.NetAmt
            };

            return(print_model);
        }
Exemple #3
0
        public static List <ArtrnVM> ToArtrnVM(this IEnumerable <PopritVM> poprits)
        {
            List <ArtrnVM> artrn = new List <ArtrnVM>();

            var p = poprits.Where(p1 => p1.IvNum != null).GroupBy(p1 => p1.IvNum);

            //Console.WriteLine(" .. >> x.count = " + p.Count());
            foreach (var item in p)
            {
                PopritVM poprit = item.First();
                artrn.Add(new ArtrnVM
                {
                    IvNum       = poprit.IvNum,
                    IvDat       = poprit.IvDat,
                    SoNum       = poprit.SoNum.Substring(0, 12).Trim(),
                    SoDat       = poprit.SoDat,
                    DealerName  = poprit.CreBy,
                    DealerType  = poprit.DealerType,
                    CustPreName = poprit.cust.First().PreName,
                    CustName    = poprit.cust.First().Name,
                    CustAddr01  = poprit.cust.First().Addr01,
                    CustAddr02  = poprit.cust.First().Addr02,
                    CustAddr03  = poprit.cust.First().Addr03,
                    CustZipCod  = poprit.cust.First().ZipCod,
                    CustTaxId   = poprit.cust.First().TaxId,
                    CustTelNum  = poprit.cust.First().TelNum,
                    CustFaxNum  = poprit.cust.First().FaxNum,
                    Remark      = poprit.IvRemark,
                    Amount      = (double)poprits.Where(po => po.IvNum != null).Where(po => po.IvNum.Trim() == poprit.IvNum.Trim()).Sum(po => po.TrnVal),
                    Disc        = poprits.Where(po => po.IvNum != null).Where(po => po.IvNum.Trim() == poprit.IvNum.Trim()).Sum(po => po.DiscAmt).ToString(),
                    DiscAmt     = (double)poprits.Where(po => po.IvNum != null).Where(po => po.IvNum.Trim() == poprit.IvNum.Trim()).Sum(po => po.DiscAmt),
                    TaxAmt      = (double)poprits.Where(po => po.IvNum != null).Where(po => po.IvNum.Trim() == poprit.IvNum.Trim()).Sum(po => po.TaxAmt),
                    VatAmt      = (double)poprits.Where(po => po.IvNum != null).Where(po => po.IvNum.Trim() == poprit.IvNum.Trim()).Sum(po => po.VatAmt),
                    NetAmt      = (double)poprits.Where(po => po.IvNum != null).Where(po => po.IvNum.Trim() == poprit.IvNum.Trim()).Sum(po => po.NetAmt),
                    EmsTracking = poprit.EmsTracking,
                    po          = poprits.Where(po => po.IvNum != null).Where(po => po.IvNum.Trim() == poprit.IvNum.Trim()).ToList()
                });
            }

            return(artrn);
        }
Exemple #4
0
        public static List <OesoVM> ToOesoVM(this IEnumerable <PopritVM> poprits)
        {
            List <OesoVM> oeso = new List <OesoVM>();
            var           p    = poprits.Where(p1 => p1.SoNum != null).GroupBy(p1 => p1.SoNum.Substring(0, 12).Trim());

            foreach (var item in p)
            {
                PopritVM poprit = item.First();
                oeso.Add(new OesoVM
                {
                    SoNum       = poprit.SoNum.Substring(0, 12).Trim(),
                    SoDat       = poprit.SoDat,
                    DealerName  = poprit.CreBy,
                    DealerType  = poprit.DealerType,
                    CustPreName = poprit.cust.First().PreName,
                    CustName    = poprit.cust.First().Name,
                    CustAddr01  = poprit.cust.First().Addr01,
                    CustAddr02  = poprit.cust.First().Addr02,
                    CustAddr03  = poprit.cust.First().Addr03,
                    CustZipCod  = poprit.cust.First().ZipCod,
                    CustTaxId   = poprit.cust.First().TaxId,
                    CustTelNum  = poprit.cust.First().TelNum,
                    CustFaxNum  = poprit.cust.First().FaxNum,
                    Remark      = poprit.SoRemark,
                    Amount      = (double)poprits.Where(po => po.SoNum != null).Where(po => po.SoNum.Substring(0, 12).Trim() == poprit.SoNum.Substring(0, 12).Trim()).Sum(po => po.TrnVal),
                    Disc        = poprits.Where(po => po.SoNum != null).Where(po => po.SoNum.Substring(0, 12).Trim() == poprit.SoNum.Substring(0, 12).Trim()).Sum(po => po.DiscAmt).ToString(),
                    DiscAmt     = (double)poprits.Where(po => po.SoNum != null).Where(po => po.SoNum.Substring(0, 12).Trim() == poprit.SoNum.Substring(0, 12).Trim()).Sum(po => po.DiscAmt),
                    TaxAmt      = (double)poprits.Where(po => po.SoNum != null).Where(po => po.SoNum.Substring(0, 12).Trim() == poprit.SoNum.Substring(0, 12).Trim()).Sum(po => po.TaxAmt),
                    VatAmt      = (double)poprits.Where(po => po.SoNum != null).Where(po => po.SoNum.Substring(0, 12).Trim() == poprit.SoNum.Substring(0, 12).Trim()).Sum(po => po.VatAmt),
                    NetAmt      = (double)poprits.Where(po => po.SoNum != null).Where(po => po.SoNum.Substring(0, 12).Trim() == poprit.SoNum.Substring(0, 12).Trim()).Sum(po => po.NetAmt),
                    po          = poprits.Where(po => po.SoNum != null).Where(po => po.SoNum.Substring(0, 12).Trim() == poprit.SoNum.Substring(0, 12).Trim()).ToList()
                });
            }

            return(oeso);
        }
Exemple #5
0
        //public ArMasDialog(MainForm main_form, Armas armas) : this()
        //{
        //    this.main_form = main_form;
        //    this.pattern_ar = armas;
        //}

        public ArMasDialog(MainForm main_form, PopritVM poprit) : this()
        {
            this.main_form = main_form;
            this.poprit    = poprit;
            //this.pattern_ar = armas;
        }
 public ViewAttachFileDialog(MainForm main_form, PopritVM poprit)
 {
     InitializeComponent();
     this.main_form = main_form;
     this.poprit    = poprit;
 }