Exemplo n.º 1
0
        public static void ReloadData()
        {
            CurrentUser = null;
            PurchaseManager.ResetCache();
            SaleManager.ResetCache();
            CustomerManager.ResetCache();
            StoreManager.ResetCache();

            List <Customer>      Customer = CustomerManager.ReadAllCustomers(false);
            List <Store>         Store    = StoreManager.AllStore;
            List <PurchaseOrder> PO       = PurchaseManager.AllPOs;
            List <SaleOrder>     SO       = SaleManager.AllSOs;

            Customer = CustomerManager.AllCustomers;
        }
        public static StoreTransfer CreateStoreTransfer(Dictionary <string, string> values)
        {
            StoreTransfer ST = NewStoreTransfer();

            ST.STDate          = values.ContainsKey("Date") ? DateTime.Parse(values["Date"]) : DateTime.Now;
            ST.Customer        = values.ContainsKey("Customer") ? CustomerManager.GetCustomerRef(values["Customer"]) : CustomerManager.GetDefaultRef();
            ST.Origin          = values.ContainsKey("Origin") ? CommonDataManager.GetOrigin(values["Origin"]) : CommonDataManager.GetDefaultRef();
            ST.Size            = values.ContainsKey("Size") ? CommonDataManager.GetOrigin(values["Size"]) : CommonDataManager.GetDefaultRef();
            ST.Vessel          = values.ContainsKey("Vessel") ? CommonDataManager.GetOrigin(values["Vessel"]) : CommonDataManager.GetDefaultRef();
            ST.Quantity        = values.ContainsKey("Quantity") ? decimal.Parse(values["Quantity"]) : 0;
            ST.FromStoreId     = values.ContainsKey("FromStore") ? StoreManager.GetStoreRef(values["FromStore"]) : StoreManager.GetDefaultRef();
            ST.ToStoreId       = values.ContainsKey("ToStore") ? StoreManager.GetStoreRef(values["ToStore"]) : StoreManager.GetDefaultRef();
            ST.VehicleNo       = values.ContainsKey("VehicleNo") ? values["VehicleNo"] : "";
            ST.BiltyNo         = values.ContainsKey("BiltyNo") ? values["BiltyNo"] : "";
            ST.BiltyDate       = values.ContainsKey("BiltyDate") ? DateTime.Parse(values["BiltyDate"]) : DateTime.MinValue;
            ST.RRInvoice       = values.ContainsKey("Invoice") ? values["Invoice"] : "";
            ST.CCMNumber       = values.ContainsKey("CCMNo") ? values["CCMNo"] : "";
            ST.Transporter     = values.ContainsKey("Transporter") ? CommonDataManager.GetTrader(values["Transporter"]) : CommonDataManager.GetDefaultRef();
            ST.StoreInDate     = DateTime.MinValue;
            ST.StoreInQuantity = 0;
            ST.Remarks         = values.ContainsKey("Remarks") ? values["Remarks"] : "";

            StoreDataManager.CreateStoreTransfer(StoreMap.reMapStoreTransferData(ST));

            // ztodo: create store movement record


            ResetCache();
            return(ST);
        }
Exemplo n.º 3
0
        public static DutyClear ValidateCreateDutyClearForm(Dictionary <string, string> values)
        {
            try
            {
                string ErrorMessage = string.Empty;

                if (values["PO"] == "0")
                {
                    ErrorMessage += "PO, ";
                }
                if (values["Customer"] == "0")
                {
                    ErrorMessage += "Customer, ";
                }
                if (string.IsNullOrEmpty(values["DCLDate"]))
                {
                    ErrorMessage += "DCL Date, ";
                }
                if (values["Store"] == "0")
                {
                    ErrorMessage += "Store, ";
                }
                if (values["Quantity"] == "0")
                {
                    ErrorMessage += "Quantity, ";
                }

                PurchaseOrder po = GetPO(values["PO"]);
                if (po != null && po.PODetailsList.Count > 0)
                {
                    foreach (PODetail pod in po.PODetailsList)
                    {
                        if (pod.Customer.Id.ToString() == values["Customer"])
                        {
                            DutyClear Dcl = NewDCL();
                            Dcl.PO = new Reference()
                            {
                                Id = po.Id, Name = po.PONumber
                            };
                            Dcl.PODetail = new Reference()
                            {
                                Id = pod.Id, Name = po.PONumber
                            };
                            Dcl.DCLDate = values.ContainsKey("DCLDate") ? DateTime.Parse(values["DCLDate"]) : DateTime.Now;
                            if (values.ContainsKey("Store"))
                            {
                                Dcl.Store = StoreManager.GetStoreRef(values["Store"].ToString());
                            }
                            Dcl.Quantity = values.ContainsKey("Quantity") ? decimal.Parse(values["Quantity"]) : 0;
                            Dcl.Remarks  = values.ContainsKey("Remarks") ? values["Remarks"] : "";

                            return(Dcl);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler.Error(ex.Message);
            }
            return(null);
        }
Exemplo n.º 4
0
        public static GRN ValidateCreateGRNForm(Dictionary <string, string> values)
        {
            try
            {
                string ErrorMessage = string.Empty;

                if (values["PO"] == "0")
                {
                    ErrorMessage += "PO, ";
                }
                if (values["Customer"] == "0")
                {
                    ErrorMessage += "Customer, ";
                }
                if (string.IsNullOrEmpty(values["GRNDate"]))
                {
                    ErrorMessage += "GRN Date, ";
                }
                if (values["Store"] == "0")
                {
                    ErrorMessage += "Store, ";
                }
                if (values["Quantity"] == "0")
                {
                    ErrorMessage += "Quantity, ";
                }

                PurchaseOrder po = GetPO(values["PO"]);
                if (po != null && po.PODetailsList.Count > 0)
                {
                    foreach (PODetail pod in po.PODetailsList)
                    {
                        if (pod.Customer.Id.ToString() == values ["Customer"])
                        {
                            GRN Grn = NewGRN();
                            Grn.PO = new Reference()
                            {
                                Id = po.Id, Name = po.PONumber
                            };
                            Grn.PODetail = new Reference()
                            {
                                Id = pod.Id, Name = po.PONumber
                            };
                            Grn.GRNDate = values.ContainsKey("GRNDate") ? DateTime.Parse(values["GRNDate"]) : DateTime.Now;
                            if (values.ContainsKey("Store"))
                            {
                                Grn.Store = StoreManager.GetStoreRef(values["Store"].ToString());
                            }
                            Grn.Quantity  = values.ContainsKey("Quantity") ? decimal.Parse(values["Quantity"]) : 0;
                            Grn.InvoiceNo = values.ContainsKey("Invoice") ? values["Invoice"] : "";
                            Grn.AdjPrice  = values.ContainsKey("Price") ? decimal.Parse(values["Price"]) : 0;
                            Grn.Remarks   = values.ContainsKey("Remarks") ? values["Remarks"] : "";

                            return(Grn);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler.Error(ex.Message);
            }
            return(null);
        }