示例#1
0
        public ActionResult UpdateInvoiceItem(int ID, string ItemName, string Descriptions, int Qty, string UOM, int Price)
        {
            objTools = new Utility();
            DMCreateNewInvoice DCI = new DMCreateNewInvoice();

            DataModel.DMNewInvoice INV = new DMNewInvoice();
            List <DMNewInvoice>    DI  = new List <DMNewInvoice>();

            INV.NoID         = ID;
            INV.Qty          = Qty;
            INV.Price        = Price;
            INV.ItemName     = ItemName;
            INV.Descriptions = Descriptions;

            List <DataModel.DMNewInvoice> ChaceInvoice = HttpContext.Cache["ChaceInvoice"] as List <DataModel.DMNewInvoice>;
            var CI = ChaceInvoice.FirstOrDefault(x => x.NoID == INV.NoID);

            CI.ItemName     = INV.ItemName;
            CI.ItemID       = INV.ItemID;
            CI.Descriptions = INV.Descriptions;
            CI.Qty          = INV.Qty;
            CI.UOM          = INV.UOM;
            CI.Price        = INV.Price;
            CI.Total        = INV.Qty * INV.Price;
            HttpContext.Cache.Insert("ChaceInvoice", ChaceInvoice, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 30, 0));
            ViewBag.Total = CountTotal(ChaceInvoice);
            DCI.ListDI    = DI;
            return(PartialView("_NewInvoice", DCI));
        }
示例#2
0
        public ActionResult FirstRow()
        {
            DMCreateNewInvoice  DCI  = new DMCreateNewInvoice();
            DMCreateNewInvoice  data = new DMCreateNewInvoice();
            List <DMNewInvoice> DI   = new List <DMNewInvoice>();
            DMNewInvoice        NI   = new DMNewInvoice();

            NI.NoID = 1;
            DI.Add(NI);
            data.Di = DI;

            var t = AddItemInvoice(data.Di);

            ViewBag.Total = CountTotal(t);
            DCI.ListDI    = t;

            return(PartialView("_NewInvoice", DCI));
        }
示例#3
0
        public ActionResult AddItem(DMCreateNewInvoice data, string submitButton)
        {
            switch (submitButton)
            {
            case  "AddRow":

                DMCreateNewInvoice DCI = new DMCreateNewInvoice();
                var t = AddItemInvoice(data.Di);
                ViewBag.Total = CountTotal(t);
                DCI.ListDI    = t;
                return(PartialView("_NewInvoice", DCI));

            case "Save":

                break;
            }

            return(View());
        }
示例#4
0
        public ActionResult DeleteInvoiceItem(int ID)
        {
            DMCreateNewInvoice DCI = new DMCreateNewInvoice();

            DataModel.DMNewInvoice INV = new DMNewInvoice();
            int i = 1;

            INV.NoID = ID;


            List <DataModel.DMNewInvoice> ChaceInvoice    = HttpContext.Cache["ChaceInvoice"] as List <DataModel.DMNewInvoice>;
            List <DataModel.DMNewInvoice> TmpChaceInvoice = new List <DataModel.DMNewInvoice>();

            foreach (DataModel.DMNewInvoice DI in ChaceInvoice)
            {
                if (DI.NoID != ID)
                {
                    DataModel.DMNewInvoice NI = new DataModel.DMNewInvoice();
                    NI.NoID         = i;
                    NI.ItemID       = DI.ItemID;
                    NI.ItemName     = DI.ItemName;
                    NI.Descriptions = DI.Descriptions;
                    NI.Qty          = DI.Qty;
                    NI.UOM          = DI.UOM;
                    NI.Price        = DI.Price;
                    NI.Total        = DI.Qty * DI.Price;
                    TmpChaceInvoice.Add(NI);
                    i++;
                }
            }
            HttpContext.Cache.Insert("ChaceInvoice", TmpChaceInvoice, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 30, 0));

            DCI.ListDI    = TmpChaceInvoice;
            ViewBag.Total = CountTotal(TmpChaceInvoice);
            return(PartialView("_NewInvoice", DCI));
        }
示例#5
0
        public ActionResult NewInvoice(int CustID = 0, string InvNo = "")
        {
            DMClientCustomerToInvoice DC = new DMClientCustomerToInvoice();

            List <DataModel.DMNewInvoice> ChaceInvoice = new List <DataModel.DMNewInvoice>();

            HttpContext.Cache.Insert("ChaceInvoice", ChaceInvoice, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 0, 0));

            DMCreateNewInvoice DCI = new DMCreateNewInvoice();

            DataModel.DMNewInvoice INV      = new DMNewInvoice();
            List <DMNewInvoice>    DI       = new List <DMNewInvoice>();
            HttpCookie             myCookie = new HttpCookie("UInfo");

            myCookie = Request.Cookies["UInfo"];
            if (myCookie != null)
            {
                INV.NoID  = 1;
                INV.Qty   = 1;
                INV.Price = 0;
                INV.Total = 0;
                DI.Add(INV);
                Hashtable hst = new Hashtable();
                objTools = new Utility();

                DataModel.DMUsersLoginDetails DL = objTools.GetClientLoginDetails(myCookie.Value.ToString());
                ViewBag.Foto     = DL.Foto;
                ViewBag.UserName = DL.FullName;
                ViewBag.ClientID = DL.ClientID;

                ViewBag.LastLogin = Convert.ToDateTime(DL.LastLogin).ToString("dd MMM yyyy HH:mm:ss");
                hst.Add("@ClientID", Convert.ToInt16(DL.ClientID));
                ViewBag.TxtMenu = objTools.CreateMenu(hst, "[SP_UsersMenuLoad]");

                var t = AddItemInvoice(DI);
                ViewBag.Total = CountTotal(t);
                DCI.ListDI    = DI;

                if (CustID > 0)
                {
                    DataTable dt = new DataTable();


                    DBA = new DBClass();
                    hst.Add("@ClientID", DL.ClientID);
                    hst.Add("@ID", CustID);
                    dt = DBA.GetDataTables("[SP_UsersCustomerDetails]", hst);
                    for (var i = 0; i <= dt.Rows.Count - 1; i++)
                    {
                        DC.ClientID      = DL.ClientID;
                        DC.ContactPerson = dt.Rows[i]["ContactPerson"].ToString();
                        DCI.NC           = DC;
                    }
                }
                else
                {
                    DCI.NC = DC;
                }

                return(View(DCI));
            }
            else
            {
                return(RedirectPermanent("/"));
            }
        }