Пример #1
0
        public string PoNumber()
        {
            string SerailNO    = "";
            var    LPONoResult = webServices.Post(new SingleStringValueResult(), "Quotation/QuotaNumber");

            if (LPONoResult.StatusCode == System.Net.HttpStatusCode.Accepted)
            {
                if (LPONoResult.Data != "[]")
                {
                    string LPNo = (new JavaScriptSerializer()).Deserialize <string>(LPONoResult.Data);


                    SerailNO = LPNo.Substring(4, 8);

                    SerailNO = SerailNO.ToString().Substring(0, 6);


                    string TotdayNumber = POClass.PONumber().Substring(0, 6);
                    int    Counts       = 0;
                    if (SerailNO == TotdayNumber)
                    {
                        Counts = Convert.ToInt32(LPNo.Substring(10, 2)) + 1;

                        if (Counts.ToString().Length == 1)
                        {
                            SerailNO = "QUO-" + TotdayNumber + "0" + Counts;
                        }
                        else
                        {
                            SerailNO = "QUO-" + TotdayNumber + Counts.ToString();
                        }
                    }
                    else
                    {
                        SerailNO = "QUO-" + POClass.PONumber();
                    }
                }
                else
                {
                    SerailNO = "QUO-" + POClass.PONumber();
                }
            }
            else
            {
                SerailNO = "QUO-" + POClass.PONumber();
            }

            return(SerailNO);
        }
Пример #2
0
        public ActionResult Create()
        {
            try
            {
                string SerailNO      = "";
                string AlreadyNumber = "";

                var LPONoResult = webServices.Post(new SingleStringValueResult(), "LPO/LPOGetPONumber");
                if (LPONoResult.StatusCode == System.Net.HttpStatusCode.Accepted)
                {
                    if (LPONoResult.Data != "[]")
                    {
                        string LPNo = (new JavaScriptSerializer()).Deserialize <string>(LPONoResult.Data);

                        SerailNO = LPNo.Substring(4, 8);
                        SerailNO = SerailNO.ToString().Substring(0, 6);

                        string TotdayNumber = POClass.PONumber().Substring(0, 6);
                        int    Counts       = 0;
                        if (SerailNO == TotdayNumber)
                        {
                            Counts = Convert.ToInt32(LPNo.Substring(10, 2)) + 1;

                            if (Counts.ToString().Length == 1)
                            {
                                SerailNO = "LPO-" + TotdayNumber + "0" + Counts;
                            }
                            else
                            {
                                SerailNO = "LPO-" + TotdayNumber + Counts.ToString();
                            }
                        }
                        else
                        {
                            AlreadyNumber = POClass.PONumber();

                            SerailNO = "LPO-" + AlreadyNumber;
                        }
                    }
                    else
                    {
                        AlreadyNumber = POClass.PONumber();

                        SerailNO = "LPO-" + AlreadyNumber;
                    }
                }
                else
                {
                    AlreadyNumber = POClass.PONumber();
                    SerailNO      = "LPO-" + AlreadyNumber;
                }

                var result = webServices.Post(new ProductViewModel(), "Product/All");
                ProductViewModel = (new JavaScriptSerializer()).Deserialize <List <ProductViewModel> >(result.Data.ToString());
                ProductViewModel.Insert(0, new ProductViewModel()
                {
                    Id = 0, Name = "Select Item"
                });
                ViewBag.Product = ProductViewModel;

                var results = webServices.Post(new ProductUnitViewModel(), "ProductUnit/All");
                productUnitViewModels = (new JavaScriptSerializer()).Deserialize <List <ProductUnitViewModel> >(results.Data.ToString());
                productUnitViewModels.Insert(0, new ProductUnitViewModel()
                {
                    Id = 0, Name = "Select Unit"
                });
                ViewBag.ProductUnit = productUnitViewModels;

                var Res = webServices.Post(new DriverViewModel(), "Vender/All");
                venderViewModels = (new JavaScriptSerializer()).Deserialize <List <VenderViewModel> >(Res.Data.ToString());
                venderViewModels.Insert(0, new VenderViewModel()
                {
                    Id = 0, Name = "Select Vender"
                });

                ViewBag.Vender = venderViewModels;

                ViewBag.titles = "LPO";
                ViewBag.PO     = SerailNO;

                LPOInvoiceViewModel lPOInvoiceVModel = new LPOInvoiceViewModel();

                lPOInvoiceVModel.FromDate = System.DateTime.Now;
                lPOInvoiceVModel.DueDate  = System.DateTime.Now;

                return(View(lPOInvoiceVModel));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }