public Product_DAL(Product_Property obj_Product)
 {
     objProduct = obj_Product;
 }
        public ActionResult AddQuotaion(int?id)
        {
            if (Session["LOGGEDIN"] != null)
            {
                objQuotationVM_Property = new QuotationVM_Property();

                Customers_Property customer       = new Customers_Property();
                Product_Property   product        = new Product_Property();
                Customers_BLL      objcustomerbll = new Customers_BLL();
                Product_BLL        objProductbll  = new Product_BLL();
                objQuotationVM_Property.CustomerLST = Helper.ConvertDataTable <Customers_Property>(objcustomerbll.ViewAllCustomers());
                objQuotationVM_Property.ProductList = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll());
                Taxes_Property obj       = new Taxes_Property();
                Taxes_BLL      objtaxBLL = new Taxes_BLL(obj);
                ViewBag.TaxList = Helper.ConvertDataTable <Taxes_Property>(objtaxBLL.GetTaxesForCheckBox());
                //objQuotationVM_Property.QuotationDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                ////objQuotationVM_Property.poNumber = "Po-001";
                if (id > 0)
                {
                    LP_Quotation_Detail_Property objmQuotationdetail;
                    objQuotationProperty     = new LP_Quotation_Master_Property();
                    objQuotationProperty.idx = Convert.ToInt16(id);

                    objquotationBll = new LP_Quotation_BLL(objQuotationProperty);
                    DataTable dt = objquotationBll.SelectOne();
                    objQuotationVM_Property.idx         = Convert.ToInt16(dt.Rows[0]["quotationIdx"].ToString());
                    objQuotationVM_Property.customerIdx = Convert.ToInt16(dt.Rows[0]["customerIdx"].ToString());
                    objQuotationVM_Property.qsNumber    = dt.Rows[0]["qsNumber"].ToString();
                    objQuotationVM_Property.description = dt.Rows[0]["description"].ToString();

                    objQuotationVM_Property.totalAmount = Convert.ToDecimal(dt.Rows[0]["totalAmount"].ToString());
                    string pdate = (dt.Rows[0]["quotationDate"].ToString()).ToString();
                    string ndate = DateTime.Parse(pdate).ToString("yyyy-MM-dd");
                    objQuotationVM_Property.quotationDate = Convert.ToDateTime(ndate);// DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    //DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    //foreach(DataRow dr in dt.Rows)
                    //{
                    //    objmrndetail

                    //}
                    ViewBag.DetailData = Helper.ConvertDataTable <QuotationVM_Property>(dt);
                    //update
                    return(View("AddQuotaion", objQuotationVM_Property));//objQuotationVM_Property
                }
                else
                {
                    objQuotationVM_Property.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString());
                    objquotationBll = new LP_Quotation_BLL();
                    LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property();
                    objtrans.TableName               = "quotation";
                    objtrans.Identityfieldname       = "idx";
                    objtrans.userid                  = Session["UID"].ToString();
                    objQuotationVM_Property.qsNumber = objquotationBll.GeneratePO(objtrans);

                    return(View("AddQuotaion", objQuotationVM_Property));//, objQuotationVM_Property
                }
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
Beispiel #3
0
        public ActionResult AddNewCI(int?id)
        {
            if (Session["LOGGEDIN"] != null)
            {
                objPurchaseVM_Property = new LP_PerformaInvoice_ViewModel();
                Vendors_Property vendor        = new Vendors_Property();
                Product_Property product       = new Product_Property();
                Vendors_BLL      objvendorbll  = new Vendors_BLL();
                Product_BLL      objProductbll = new Product_BLL();
                LP_MRN_BLL       objMRNbll     = new LP_MRN_BLL();

                objPurchaseVM_Property.VendorLST         = Helper.ConvertDataTable <Vendors_Property>(objvendorbll.ViewAll());
                objPurchaseVM_Property.DepartmentList    = Helper.ConvertDataTable <Departments_property>(GetAllDepartments());
                objPurchaseVM_Property.PurchaseType_List = Helper.ConvertDataTable <LP_Purchase_Type>(GetAllPurchaseType());
                objPurchaseVM_Property.ProductList       = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll());
                objPurchaseVM_Property.purchaseDate      = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                //objPurchaseVM_Property.poNumber = "Po-001";
                if (id > 0)
                {
                    LP_Purchase_Detail_Property objmpurchasedetail;
                    objPurchaseProperty     = new LP_Performa_Invoice_Property();
                    objPurchaseProperty.idx = Convert.ToInt16(id);

                    objpurchaseBll = new LP_PI_BLL();
                    DataTable dt = objpurchaseBll.SelectOne();
                    objPurchaseVM_Property.idx         = Convert.ToInt16(dt.Rows[0]["purchaseIdx"].ToString());
                    objPurchaseVM_Property.vendorIdx   = Convert.ToInt16(dt.Rows[0]["vendorIdx"].ToString());
                    objPurchaseVM_Property.poNumber    = dt.Rows[0]["poNumber"].ToString();
                    objPurchaseVM_Property.description = dt.Rows[0]["description"].ToString();

                    objPurchaseVM_Property.DepartmentID = Convert.ToInt16(dt.Rows[0]["DepartmentID"].ToString());
                    objPurchaseVM_Property.totalAmount  = Convert.ToDecimal(dt.Rows[0]["totalAmount"].ToString());
                    string pdate = (dt.Rows[0]["purchaseDate"].ToString()).ToString();
                    string ndate = DateTime.Parse(pdate).ToString("yyyy-MM-dd");
                    objPurchaseVM_Property.purchaseDate = Convert.ToDateTime(ndate);// DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    //DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    //foreach(DataRow dr in dt.Rows)
                    //{
                    //    objmrndetail

                    //}
                    ViewBag.DetailData = Helper.ConvertDataTable <PurchaseVM_Property>(dt);
                    //update
                    return(View("AddNewCI", objPurchaseVM_Property));
                }
                else
                {
                    //objPurchaseProperty = new LP_Purchase_Master_Property();
                    objPurchaseVM_Property.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString());
                    objpurchaseBll = new LP_PI_BLL();
                    LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property();
                    objtrans.TableName              = "CommercialInvoice";
                    objtrans.Identityfieldname      = "idx";
                    objtrans.userid                 = Session["UID"].ToString();
                    objPurchaseVM_Property.poNumber = objpurchaseBll.GeneratePINo(objtrans);
                    //objPurchaseProperty.poNumber = "";
                    //objpurchaseBll = new LP_Purchase_BLL(objPurchaseProperty);
                    //objPurchaseVM_Property.poNumber = objpurchaseBll.GeneratePO();// "PO-001";
                    // string po = objpurchaseBll.GeneratePO();

                    return(View("AddNewCI", objPurchaseVM_Property));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
Beispiel #4
0
        public ActionResult AddNewProduct(int?id)
        {
            if (Session["LOGGEDIN"] != null)
            {
                objProductProperty     = new Product_Property();
                objProductProperty.idx = Convert.ToInt32(id);
                //objProductProperty.branchIdx = 1;//It will have the value of session branchIdx
                objProductBLL = new Product_BLL(objProductProperty);
                DataTable categories = objProductBLL.ddlCategory();
                List <Product_Category_Property> catLST = new List <Product_Category_Property>();
                DataTable subCategories = objProductBLL.ddlSubCategory();
                List <Product_SubCategory_Property> subCatLST = new List <Product_SubCategory_Property>();
                DataTable productTypes = objProductBLL.ddlProductType();
                List <Product_Type_Property> productTypeLST = new List <Product_Type_Property>();
                DataTable units = objProductBLL.ddlUnit();
                List <itemUnit_Property> unitLST = new List <itemUnit_Property>();
                foreach (DataRow dr in categories.Rows)
                {
                    Product_Category_Property objProductCat = new Product_Category_Property();
                    objProductCat.Category = dr["category"].ToString();
                    objProductCat.idx      = Convert.ToInt32(dr["idx"].ToString());
                    catLST.Add(objProductCat);
                }
                ViewBag.catLST = catLST;
                foreach (DataRow dr in subCategories.Rows)
                {
                    Product_SubCategory_Property objProductCat = new Product_SubCategory_Property();
                    objProductCat.subCategory = dr["subCategory"].ToString();
                    objProductCat.idx         = Convert.ToInt32(dr["idx"].ToString());
                    subCatLST.Add(objProductCat);
                }
                ViewBag.subCatLST = subCatLST;
                foreach (DataRow dr in productTypes.Rows)
                {
                    Product_Type_Property objProductCat = new Product_Type_Property();
                    objProductCat.productType = dr["productType"].ToString();
                    objProductCat.idx         = Convert.ToInt32(dr["idx"].ToString());
                    productTypeLST.Add(objProductCat);
                }
                ViewBag.productTypeLST = productTypeLST;
                foreach (DataRow dr in units.Rows)
                {
                    itemUnit_Property objProductCat = new itemUnit_Property();
                    objProductCat.itemUnit = dr["itemUnit"].ToString();
                    objProductCat.idx      = Convert.ToInt32(dr["idx"].ToString());
                    unitLST.Add(objProductCat);
                }
                ViewBag.unitLST = unitLST;

                objProductProperty.ProductLST = Helper.ConvertDataTable <Product_Property>(objProductBLL.ViewAll());
                if (id != null && id != 0)
                {
                    decimal cp, sp, pt;
                    var     dt = objProductBLL.GetById(id);
                    //objProductProperty.companyIdx = 1;
                    objProductProperty.idx              = int.Parse(dt.Rows[0]["idx"].ToString());
                    objProductProperty.productTypeIdx   = int.Parse(dt.Rows[0]["productTypeIdx"].ToString());
                    objProductProperty.productCatIdx    = int.Parse(dt.Rows[0]["productCatIdx"].ToString());
                    objProductProperty.productSubCatIdx = int.Parse(dt.Rows[0]["productSubCatIdx"].ToString());
                    objProductProperty.unitIdx          = int.Parse(dt.Rows[0]["unitIdx"].ToString());
                    objProductProperty.HSCODE           = (dt.Rows[0]["HSCODE"].ToString());
                    objProductProperty.itemCode         = (dt.Rows[0]["itemCode"].ToString());
                    objProductProperty.itemName         = (dt.Rows[0]["itemName"].ToString());
                    objProductProperty.description      = (dt.Rows[0]["description"].ToString());
                    //objProductProperty.costPrice = 0.00m;
                    string costPrice = (dt.Rows[0]["costPrice"].ToString());
                    decimal.TryParse(costPrice, out cp);
                    objProductProperty.costPrice = cp;
                    string salePrice = (dt.Rows[0]["salePrice"].ToString());
                    decimal.TryParse(salePrice, out sp);
                    objProductProperty.salePrice = sp;
                    string productTax = (dt.Rows[0]["productTax"].ToString());
                    decimal.TryParse(productTax, out pt);
                    objProductProperty.productTax = pt;
                    //objProductProperty.product_catIdx = int.Parse(dt.Rows[0]["product_catIdx"].ToString());
                    //objProductProperty.subCategory = dt.Rows[0]["subCategory"].ToString();
                    //objProductProperty.HS_CodeSub = dt.Rows[0]["HS_CodeSub"].ToString();
                    ////objProductProperty.firstName = dt.Rows[0]["firstName"].ToString();
                    //objProductProperty.lastName = dt.Rows[0]["lastName"].ToString();
                    //objProductProperty.CNIC = (dt.Rows[0]["CNIC"].ToString());
                    //objProductProperty.cellNumber = (dt.Rows[0]["cellNumber"].ToString());
                    //objProductProperty.loginId = (dt.Rows[0]["loginId"].ToString());
                    //objProductProperty.password = dt.Rows[0]["password"].ToString();
                }
                else
                {
                    LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property();
                    objtrans.TableName          = "products";
                    objtrans.Identityfieldname  = "idx";
                    objtrans.userid             = Session["UID"].ToString();
                    objProductProperty.itemCode = objProductBLL.GenerateProductCode(objtrans);
                }


                return(PartialView("_AddNewProduct", objProductProperty));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
Beispiel #5
0
        public ActionResult AddNewSalesOrder(int?id)
        {
            if (Session["LOGGEDIN"] != null)
            {
                objSalesOrderVM_Property = new SalesOrderVM_Property();
                Customers_Property vendor          = new Customers_Property();
                Product_Property   product         = new Product_Property();
                Customers_BLL      objcustomerbll  = new Customers_BLL();
                Product_BLL        objProductbll   = new Product_BLL();
                LP_Quotation_BLL   objQuotationbll = new LP_Quotation_BLL();
                WareHouse_BLL      objWareHouseBLL = new WareHouse_BLL();
                objSalesOrderVM_Property.QSList        = Helper.ConvertDataTable <LP_Quotation_Master_Property>(objQuotationbll.SelectQS());
                objSalesOrderVM_Property.CustomerLST   = Helper.ConvertDataTable <Customers_Property>(objcustomerbll.ViewAllCustomers());
                objSalesOrderVM_Property.ProductList   = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll());
                objSalesOrderVM_Property.BankList      = Helper.ConvertDataTable <Company_Bank_Property>(GetAllCompanyBanks());
                objSalesOrderVM_Property.wareHouseList = Helper.ConvertDataTable <WareHouse_Property>(objWareHouseBLL.SelectAll());

                objSalesOrderVM_Property.salesorderDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                Taxes_Property obj       = new Taxes_Property();
                Taxes_BLL      objtaxBLL = new Taxes_BLL(obj);
                ViewBag.TaxList = Helper.ConvertDataTable <Taxes_Property>(objtaxBLL.GetTaxesForCheckBox());
                //objSalesOrderVM_Property.poNumber = "Po-001";
                if (id > 0)
                {
                    LP_SalesOrder_Detail_Property objmSalesOrderdetail;
                    objSalesOrderProperty     = new LP_SalesOrder_Master_Property();
                    objSalesOrderProperty.idx = Convert.ToInt16(id);

                    objSalesOrderBll = new LP_SalesOrder_BLL(objSalesOrderProperty);
                    DataTable dt = objSalesOrderBll.SelectOne();
                    objSalesOrderVM_Property.idx         = Convert.ToInt16(dt.Rows[0]["salesorderIdx"].ToString());
                    objSalesOrderVM_Property.customerIdx = Convert.ToInt32(dt.Rows[0]["customerIdx"].ToString());
                    objSalesOrderVM_Property.soNumber    = dt.Rows[0]["soNumber"].ToString();
                    objSalesOrderVM_Property.description = dt.Rows[0]["description"].ToString();
                    objSalesOrderVM_Property.qsIdx       = Convert.ToInt16(dt.Rows[0]["qsIdx"].ToString());
                    objSalesOrderVM_Property.totalAmount = Convert.ToDecimal(dt.Rows[0]["totalAmount"].ToString());
                    string pdate = (dt.Rows[0]["salesorderdate"].ToString()).ToString();
                    string ndate = DateTime.Parse(pdate).ToString("yyyy-MM-dd");
                    objSalesOrderVM_Property.salesorderDate = Convert.ToDateTime(ndate);// DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    //DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd");
                    //foreach(DataRow dr in dt.Rows)
                    //{
                    //    objmrndetail

                    //}
                    ViewBag.DetailData = Helper.ConvertDataTable <SalesOrderVM_Property>(dt);
                    //update
                    return(View("AddNewSalesOrder", objSalesOrderVM_Property));
                }
                else
                {
                    //objSalesOrderProperty = new LP_SalesOrder_Master_Property();
                    objSalesOrderVM_Property.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString());
                    objSalesOrderBll = new LP_SalesOrder_BLL();
                    LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property();
                    objtrans.TableName         = "SalesOrder";
                    objtrans.Identityfieldname = "idx";
                    objtrans.userid            = Session["UID"].ToString();

                    objSalesOrderVM_Property.soNumber = objSalesOrderBll.GenerateSO(objtrans);
                    //objSalesOrderProperty.poNumber = "";
                    //objSalesOrderBll = new LP_SalesOrder_BLL(objSalesOrderProperty);
                    //objSalesOrderVM_Property.poNumber = objSalesOrderBll.GeneratePO();// "PO-001";
                    // string po = objSalesOrderBll.GeneratePO();

                    return(View("AddNewSalesOrder", objSalesOrderVM_Property));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
Beispiel #6
0
 public Product_BLL(Product_Property objProduct_Property)
 {
     objProductProperty = objProduct_Property;
 }