예제 #1
0
        void createReport()
        {
            foreach (DataTable dt in tables)
            {
                foreach (DataRow r in dt.Rows)
                {
                    bool found = false;
                    foreach (itemreport i in itemreport.saleTable)
                    {
                        string name       = r["product"].ToString();
                        int    rate       = int.Parse(r["rate"].ToString());
                        int    tradeOffer = int.Parse(r["tradeOffer"].ToString());
                        string expiry     = r["expiry"].ToString();
                        if (i.name == name && i.rate == rate && i.tradeoffer == tradeOffer && i.expiry == expiry)
                        {
                            incrementQuantity(r, i);
                            found = true;
                            break;
                        }
                    }

                    if (found == false)
                    {
                        itemreport i = createNewItem(r);
                        itemreport.saleTable.Add(i);
                    }
                }
            }
        }
예제 #2
0
        itemreport createNewItem(DataRow r)
        {
            itemreport i = new itemreport();

            i.totalCart    = int.Parse(r["qtycarton"].ToString());
            i.totalpc      = int.Parse(r["qtypc"].ToString());
            i.returnedcart = int.Parse(r["returnedCart"].ToString());
            i.returnedpc   = int.Parse(r["returnedpc"].ToString());
            i.replacedcart = int.Parse(r["replacedcart"].ToString());
            i.replacedpc   = int.Parse(r["replacedpc"].ToString());
            i.soldcart     = int.Parse(r["soldcart"].ToString());
            i.soldpc       = int.Parse(r["soldpc"].ToString());
            i.name         = r["product"].ToString();
            i.rate         = int.Parse(r["rate"].ToString());
            i.expiry       = r["expiry"].ToString();
            i.tradeoffer   = int.Parse(r["tradeoffer"].ToString());
            i.crt          = int.Parse(r["crt"].ToString());
            return(i);
        }
예제 #3
0
        DataRow createNewRow(DataRow r, itemreport i)
        {
            r["Product"]  = i.name;
            r["crt"]      = i.crt;
            r["rate"]     = i.rate;
            r["expiry"]   = i.expiry;
            r["T/O"]      = i.tradeoffer;
            r["total"]    = i.totalCart + "C, " + i.totalpc + "P";
            r["returned"] = i.returnedcart + "C, " + i.returnedpc + "P";
            r["replaced"] = i.replacedcart + "C, " + i.replacedpc + "P";
            r["sold"]     = i.soldcart + "C, " + i.soldpc + "P";
            int load = 0;

            foreach (string bill in Salesman.bills)
            {
                r["Load " + ++load] = bill;
            }

            return(r);
        }
예제 #4
0
        void incrementQuantity(DataRow r, itemreport i)
        {
            int totalCart    = int.Parse(r["qtycarton"].ToString());
            int totalPc      = int.Parse(r["qtypc"].ToString());
            int returnedCart = int.Parse(r["returnedCart"].ToString());
            int returnedpc   = int.Parse(r["returnedpc"].ToString());
            int replacedCart = int.Parse(r["replacedcart"].ToString());
            int replacedpc   = int.Parse(r["replacedpc"].ToString());
            int soldCart     = int.Parse(r["soldcart"].ToString());
            int soldpc       = int.Parse(r["soldpc"].ToString());

            i.totalCart    += totalCart;
            i.totalpc      += totalPc;
            i.returnedcart += returnedCart;
            i.returnedpc   += returnedpc;
            i.replacedcart += replacedCart;
            i.replacedpc   += replacedpc;
            i.soldcart     += soldCart;
            i.soldpc       += soldpc;
        }