private Inv_RChallan ConvertTmpToRchallan(Inv_RChallan_Temp t)
        {
            Inv_RChallan c = new Inv_RChallan();

            c.BalanceQty        = t.BalanceQuanity;
            c.Barcode           = t.BarCode;
            c.Brand             = t.Brand;
            c.ChallanDate       = t.PurchaseDate;
            c.ChallanNo         = t.ChallanNo;
            c.ChallanTotal      = t.ChallanTotal;
            c.CompanyCode       = t.CompanyCode;
            c.CompanyId         = t.CompanyId;
            c.CompanyName       = t.CompanyName;
            c.CPU               = t.CPU;
            c.DeliveryQty       = t.DeliveryQty;
            c.EditDate          = t.EditDate;
            c.EditUser          = t.EditUser;
            c.FloorName         = t.FloorName;
            c.Id                = t.Id;
            c.PurchaseDate      = t.PurchaseDate;
            c.Ocode             = t.OCode;
            c.ProductGroup      = t.ProductGroup;
            c.ProductId         = t.ProductId;
            c.ProductName       = t.ProductName;
            c.ReceiveQuantity   = t.ReceiveQuantity;
            c.RPU               = t.RPU;
            c.ExpireDate        = t.ExpireDate;
            c.StyleSize         = t.StyleSize;
            c.SupplierCode      = t.SupplierCode;
            c.SupplierReturnQty = t.SupplierReturnQty;
            c.UnitName          = t.UnitName;

            // if neeeded
            //c.VailPerPack = t.VailPerPack;
            //c.TestPerVail = t.TestPerVail;
            //c.TotalVailQty = t.TotalVailQty;
            //c.BalanceStatus = t.BalanceStatus;

            c.Item_Remarks      = t.Item_Remarks;
            c.PO_No             = t.PO_No;
            c.Mode_Of_Delivery  = t.Mode_Of_Delivery;
            c.Unit_Cheked       = t.Unit_Cheked;
            c.Reciept_Condition = t.Reciept_Condition;
            c.Delivery_Type     = t.Delivery_Type;
            c.Senior_Packer_EID = t.Senior_Packer_EID;
            c.Move_Coordinator  = t.Move_Coordinator;
            c.Project_Code      = t.Project_Code;
            c.Store_Id          = t.Store_Id;
            c.Store_Unit_Id     = t.Store_Unit_Id;

            return(c);
        }
Beispiel #2
0
 internal int Insert(Inv_RChallan rChallan_Obj)
 {
     try
     {
         _context.Inv_RChallan.AddObject(rChallan_Obj);
         _context.SaveChanges();
         return(1);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #3
0
 internal int Update_Rchallan(int Id, string OrderNo)
 {
     try
     {
         Inv_RChallan prodObj = _context.Inv_RChallan.First(x => x.Id == Id);
         prodObj.OrderNo = OrderNo;
         _context.SaveChanges();
         return(1);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #4
0
        private Inv_RChallan ConvertTmpToRchallan(Inv_RChallan_Temp t)
        {
            Inv_RChallan c = new Inv_RChallan();

            c.BalanceQty        = t.BalanceQuanity;
            c.Barcode           = t.BarCode;
            c.Brand             = t.Brand;
            c.ChallanDate       = t.ChallanDate;
            c.ChallanNo         = t.ChallanNo;
            c.ChallanTotal      = t.ChallanTotal;
            c.CompanyCode       = t.CompanyCode;
            c.CompanyId         = t.CompanyId;
            c.CompanyName       = t.CompanyName;
            c.CPU               = t.CPU;
            c.DeliveryQty       = t.DeliveryQty;
            c.EditDate          = t.EditDate;
            c.EditUser          = t.EditUser;
            c.FloorName         = t.FloorName;
            c.Id                = t.Id;
            c.PurchaseDate      = t.PurchaseDate;
            c.Ocode             = t.OCode;
            c.ProductGroup      = t.ProductGroup;
            c.ProductId         = t.ProductId;
            c.ProductName       = t.ProductName;
            c.ReceiveQuantity   = t.ReceiveQuantity;
            c.Remarks           = t.Item_Remarks;
            c.RPU               = t.RPU;
            c.ExpireDate        = t.ExpireDate;
            c.StyleSize         = t.StyleSize;
            c.FloorName         = t.FloorName;
            c.SupplierCode      = t.SupplierCode;
            c.SupplierId        = t.SupplierId;
            c.SupplierReturnQty = t.SupplierReturnQty;
            c.UnitName          = t.UnitName;
            c.OrderNo           = t.OrderNo;

            // if neeeded
            //c.VailPerPack = t.VailPerPack;
            //c.TestPerVail = t.TestPerVail;
            //c.TotalVailQty = t.TotalVailQty;
            //c.BalanceStatus = t.BalanceStatus;
            return(c);
        }
        protected void btnTransfer_Click(object sender, EventArgs e)
        {
            try
            {
                bool status      = true;
                bool CheckStatus = false;

                foreach (GridViewRow gvRow in grvPOItemList.Rows)
                {
                    CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));

                    if (rowChkBox.Checked == true)
                    {
                        CheckStatus = true;
                    }
                }

                if (CheckStatus)
                {
                    foreach (GridViewRow gvRow in grvPOItemList.Rows)
                    {
                        CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));

                        if (rowChkBox.Checked == true)
                        {
                            TextBox txtbxReceive = (TextBox)gvRow.FindControl("txtbxReceiveAmount");
                            if (txtbxReceive.Text != "")
                            {
                                //Label lblLastRceceive = ((Label)gvRow.FindControl("lblLastReceive"));
                                //double lastReceive = Convert.ToDouble(lblLastRceceive.Text);

                                double ReceiveQty = Convert.ToDouble(txtbxReceive.Text);

                                Label  lblOrderQty = ((Label)gvRow.FindControl("lblOrderQty"));
                                double Poqty       = Convert.ToDouble(lblOrderQty.Text);

                                if (ReceiveQty == 0)
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Check Quantity!')", true);
                                    status = false;
                                    break;
                                }
                                //else if (ReceiveQty + lastReceive > Poqty)
                                //{
                                //    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Check Quantity!')", true);
                                //    status = false;
                                //    break;
                                //}
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Receive Qty!')", true);
                                status = false;
                                break;
                            }
                        }
                    }

                    if (status)
                    {
                        foreach (GridViewRow gvRow in grvPOItemList.Rows)
                        {
                            CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));

                            if (rowChkBox.Checked == true)
                            {
                                Label lbl = ((Label)gvRow.FindControl("lblID"));

                                Label lblPO = ((Label)gvRow.FindControl("lblPONo"));

                                Label lblOrderQty     = ((Label)gvRow.FindControl("lblOrderQty"));
                                Label lblStyleAndSize = ((Label)gvRow.FindControl("lblStyleAndSize"));


                                TextBox txtbxReceive = (TextBox)gvRow.FindControl("txtbxReceiveAmount");
                                double  ReceiveQty   = Convert.ToDouble(txtbxReceive.Text);

                                DropDownList ddlStoreName = (DropDownList)gvRow.FindControl("ddlStoreName");

                                //Label lblLastRceceive = ((Label)gvRow.FindControl("lblLastReceive"));
                                //double lastReceive = Convert.ToDouble(lblLastRceceive.Text);
                                TextBox txtRemarks  = (TextBox)gvRow.FindControl("txtRemarks");
                                string  ItemsRemark = txtRemarks.Text;

                                //for new product

                                int Id = Convert.ToInt16(lbl.Text);
                                //if (IsExist(Id))
                                //{
                                //    ProductBLL _productBll = new ProductBLL();
                                //    LC_PurchaseOrder purchaseorder = aLC_RequisitionBLL.GetPurchaseOrderById(Id);

                                //if (!IsExist(purchaseorder))
                                //{
                                //    Inv_Product _productObj = new Inv_Product();
                                //    _productObj.ProductName = purchaseorder.ProductName;
                                //    _productObj.StyleAndSize = purchaseorder.StyleAndSize;
                                //    _productObj.ReOrderQty = 0;
                                //    _productObj.Price = purchaseorder.Price;
                                //    _productObj.Brand = "HB";
                                //    _productObj.GroupId = purchaseorder.GroupId;
                                //    _productObj.UnitId = purchaseorder.UnitId;
                                //    _productObj.UnitName = purchaseorder.UnitName;
                                //    _productObj.EditDate = DateTime.Now;
                                //    _productObj.EditUser = ((SessionUser)Session["SessionUser"]).UserId;
                                //    _productObj.OCode = ((SessionUser)Session["SessionUser"]).OCode.ToString();
                                //    int productId = _productBll.InsertProductAndGetID(_productObj);
                                //    if (productId > 0)
                                //    {
                                //        _purchaseOrderbll.UpdatePurchaseOrder(Id, productId);

                                //    }
                                //}
                                //}

                                string CType = "CENTRAL";
                                if (CType == "CENTRAL")
                                {
                                    LC_PurchaseOrder purchaseorder = aLC_RequisitionBLL.GetPurchaseOrderById(Id);

                                    //if (purchaseorder.ItemType == "New Item")
                                    //{
                                    //    string productName = purchaseorder.ProductName.ToString();
                                    //    string StyleandSize = purchaseorder.StyleAndSize.ToString();
                                    //    Inv_Product _invProduct = _purchaseOrderbll.GetProductByProductNameandStyle(productName, StyleandSize);
                                    //    //   Inv_Product _invProduct = _purchaseOrderbll.GetProductByProductId(Convert.ToInt32(purchaseorder.BarCode));
                                    //    string id = Convert.ToString(Id);
                                    //    string ChalanNo = GetChalanNo(id);
                                    //    Inv_BuyCentral buyCentral = buyCentralBll.GetBuyCentralByCompanyAndBarcode(hdnBarCode.Value, ddlCompanyCode.SelectedValue);
                                    //    if (buyCentral == null)
                                    //    { // Insert New
                                    //        Inv_BuyCentral newBuyCentral = new Inv_BuyCentral();
                                    //        newBuyCentral.ChallanNo = ChalanNo;
                                    //        //newBuyCentral.CompanyId = Convert.ToInt32(ddlCompanyCode.SelectedValue);
                                    //        newBuyCentral.CompanyCode = HiddenCompanyCode.Value;
                                    //        newBuyCentral.CompanyName = HiddenCompanyName.Value;
                                    //        newBuyCentral.BarCode = _invProduct.ProductId.ToString();
                                    //        newBuyCentral.ProductId = _invProduct.ProductId;
                                    //        newBuyCentral.ProductGroup = _invProduct.GroupId;
                                    //        newBuyCentral.ProductName = _invProduct.ProductName;
                                    //        newBuyCentral.Brand = _invProduct.Brand;
                                    //        newBuyCentral.Item_Remarks = ItemsRemark;
                                    //        //-------------------------------------------------------------
                                    //        //if (ddlProject.SelectedValue != "0")
                                    //        //{
                                    //        //    newBuyCentral.Project_Code = ddlProject.SelectedValue;
                                    //        //}

                                    //        if (ddlStoreName.SelectedValue != "0")
                                    //        {
                                    //            newBuyCentral.Store_Code = ddlStoreName.SelectedValue.ToString();
                                    //        }

                                    //        //if (ddlStoreUnit.SelectedValue != "0")
                                    //        //{
                                    //        //    newBuyCentral.Store_Unit_Id = Convert.ToInt16(ddlStoreUnit.SelectedValue);
                                    //        //}

                                    //        //DropDownList drpumCheck = (DropDownList)gvRow.FindControl("drpumCkeck");
                                    //        //DropDownList drpRecieptCondition = (DropDownList)gvRow.FindControl("ddlRecieptCondition");

                                    //        newBuyCentral.StyleSize = _invProduct.StyleAndSize;
                                    //        //newBuyCentral.FloorName = rchallan.FloorName;
                                    //        newBuyCentral.UnitName = _invProduct.UnitName;
                                    //        newBuyCentral.ReceiveQuantity = ReceiveQty;// Convert.ToInt32(purchaseorder.OrderedQty);
                                    //        //newBuyCentral.CPU = rchallan.CPU;
                                    //        //newBuyCentral.RPU = rchallan.RPU;
                                    //        //newBuyCentral.ExpireDate = rchallan.ExpireDate;
                                    //        newBuyCentral.BalanceQuanity = ReceiveQty;//Convert.ToInt32(purchaseorder.OrderedQty);
                                    //        try
                                    //        {
                                    //            newBuyCentral.PurchaseDate = DateTime.Now;
                                    //        }
                                    //        catch
                                    //        {
                                    //            newBuyCentral.PurchaseDate = DateTime.Today;
                                    //        }

                                    //        newBuyCentral.EditDate = DateTime.Now;
                                    //        newBuyCentral.EditUser = ((SessionUser)Session["SessionUser"]).UserId;
                                    //        newBuyCentral.OCode = ((SessionUser)Session["SessionUser"]).OCode;
                                    //        buyCentralBll.Insert(newBuyCentral);
                                    //    }

                                    //    else
                                    //    {
                                    //        buyCentral.BalanceQuanity = buyCentral.BalanceQuanity + ReceiveQty;// Convert.ToInt32(purchaseorder.OrderedQty);
                                    //        //buyCentral.CPU = rchallan.CPU;
                                    //        //buyCentral.RPU = rchallan.RPU;
                                    //        //buyCentral.ExpireDate = rchallan.ExpireDate;
                                    //        buyCentral.ReceiveQuantity = buyCentral.ReceiveQuantity + ReceiveQty;// Convert.ToInt32(purchaseorder.OrderedQty);
                                    //        buyCentralBll.Update(buyCentral, Convert.ToInt32(buyCentral.Id));
                                    //    }
                                    //    //}
                                    //    Inv_RChallan rchallan = new Inv_RChallan();
                                    //    rchallan.ChallanNo = ChalanNo;
                                    //    rchallan.PO_No = lblPO.Text;
                                    //    rchallan.ChallanDate = DateTime.Now;
                                    //    //   rchallan.CompanyId = Convert.ToInt32(ddlCompanyCode.SelectedValue);
                                    //    rchallan.CompanyCode = HiddenCompanyCode.Value;
                                    //    rchallan.CompanyName = HiddenCompanyName.Value;
                                    //    rchallan.Barcode = hdnBarCode.Value;
                                    //    rchallan.ProductId = _invProduct.ProductId;
                                    //    rchallan.ProductGroup = _invProduct.GroupId;
                                    //    rchallan.ProductName = _invProduct.ProductName;
                                    //    rchallan.Brand = _invProduct.Brand;
                                    //    rchallan.Remarks = ItemsRemark;

                                    //    //if (ddlProject.SelectedValue != "0")
                                    //    //{

                                    //    //    rchallan.Project_Code = ddlProject.SelectedValue;
                                    //    //}

                                    //    if (ddlStoreName.SelectedValue != "0")
                                    //    {
                                    //        rchallan.Store_Code = ddlStoreName.SelectedValue.ToString();
                                    //    }
                                    //    //if (ddlStoreUnit.SelectedValue != "0")
                                    //    //{
                                    //    //    rchallan.Store_Unit_Id = Convert.ToInt16(ddlStoreUnit.SelectedValue);
                                    //    //}

                                    //    //DropDownList drpumCheck1 = (DropDownList)gvRow.FindControl("drpumCkeck");
                                    //    //DropDownList drpRecieptConditio1n = (DropDownList)gvRow.FindControl("ddlRecieptCondition");

                                    //    //if (drpumCheck1.SelectedValue != "0")
                                    //    //{
                                    //    //    rchallan.Unit_Cheked = drpumCheck1.SelectedItem.Text;
                                    //    //}

                                    //    //if (drpRecieptConditio1n.SelectedValue != "0")
                                    //    //{
                                    //    //    rchallan.Reciept_Condition = drpRecieptConditio1n.SelectedItem.Text;
                                    //    //}

                                    //    //rchallan.StyleSize = rchallan.StyleSize;
                                    //    //rchallan.FloorName = rchallan.FloorName;
                                    //    rchallan.UnitName = _invProduct.UnitName;
                                    //    rchallan.ReceiveQuantity = ReceiveQty;// Convert.ToInt32(purchaseorder.OrderedQty);
                                    //    //rchallan.CPU = rchallan.CPU;
                                    //    //rchallan.RPU = rchallan.RPU;
                                    //    //rchallan.ExpireDate = rchallan.ExpireDate;
                                    //    rchallan.BalanceQty = ReceiveQty;// Convert.ToInt32(purchaseorder.OrderedQty);
                                    //    try
                                    //    {
                                    //        rchallan.PurchaseDate = DateTime.Today;
                                    //    }
                                    //    catch
                                    //    {
                                    //        rchallan.PurchaseDate = DateTime.Today;
                                    //    }

                                    //    rchallan.EditDate = DateTime.Now;
                                    //    rchallan.EditUser = ((SessionUser)Session["SessionUser"]).UserId;
                                    //    rchallan.Ocode = ((SessionUser)Session["SessionUser"]).OCode;
                                    //    rChallanBll.Insert(rchallan);
                                    //    //  string Po = lblPO.Text;

                                    //    if (lastReceive == 0 && ReceiveQty == Convert.ToDouble(lblOrderQty.Text))
                                    //    {

                                    //        PurchaseOrderBll.PurchaseDone(id);
                                    //        // PurchaseOrderBll.UpdateLastQty(id, ReceiveQty);
                                    //    }
                                    //    else if ((Convert.ToInt16(lblOrderQty.Text) == ReceiveQty + Convert.ToInt16(lastReceive)))
                                    //    {

                                    //        PurchaseOrderBll.UpdateLastQty(id, ReceiveQty);
                                    //        PurchaseOrderBll.PurchaseDone(id);
                                    //        // PurchaseOrderBll.UpdateLastQty(id, ReceiveQty);
                                    //    }
                                    //    else
                                    //    {
                                    //        ReceiveQty = ReceiveQty + Convert.ToDouble(lastReceive);
                                    //        PurchaseOrderBll.UpdateLastQty(id, ReceiveQty);
                                    //    }

                                    //    // lblMessage.Text = "<font color='green'>Purchase information posted successfully</font>";
                                    //    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Purchase information posted successfully')", true);
                                    //    SetGriview();
                                    //}
                                    //else
                                    //{

                                    int productId = Convert.ToInt32(purchaseorder.ProductId);
                                    ERPSSL.LC.DAL.Inv_Product _invProduct = aLC_RequisitionBLL.GetProductByProductID(productId);

                                    //   Inv_Product _invProduct = _purchaseOrderbll.GetProductByProductId(Convert.ToInt32(purchaseorder.BarCode));

                                    string id = Convert.ToString(Id);

                                    string ChalanNo = rChallanBll.GetNewRChalanNo(purchaseorder.SupplierCode, DateTime.Now);
                                    //string ChalanNo = GetChalanNo(id);

                                    //ERPSSL.INV.DAL.Inv_BuyCentral buyCentral = buyCentralBll.GetBuyCentralByCompanyAndBarcode(productId, ddlCompanyCode.SelectedValue);

                                    ERPSSL.INV.DAL.Inv_BuyCentral buyCentral = buyCentralBll.GetBuyCentralByCompanyAndBarcode(productId.ToString(), ddlCompanyCode.SelectedValue);

                                    if (buyCentral == null)
                                    { // Insert New
                                        ERPSSL.INV.DAL.Inv_BuyCentral newBuyCentral = new ERPSSL.INV.DAL.Inv_BuyCentral();
                                        newBuyCentral.ChallanNo = ChalanNo;
                                        //newBuyCentral.CompanyId = Convert.ToInt32(ddlCompanyCode.SelectedValue);
                                        newBuyCentral.CompanyCode  = HiddenCompanyCode.Value;
                                        newBuyCentral.CompanyName  = HiddenCompanyName.Value;
                                        newBuyCentral.BarCode      = _invProduct.ProductId.ToString();
                                        newBuyCentral.ProductId    = _invProduct.ProductId;
                                        newBuyCentral.ProductGroup = _invProduct.GroupId;
                                        newBuyCentral.ProductName  = _invProduct.ProductName;
                                        newBuyCentral.Brand        = _invProduct.Brand;
                                        newBuyCentral.Item_Remarks = ItemsRemark;

                                        //if (ddlProject.SelectedValue != "0")
                                        //{
                                        //    newBuyCentral.Project_Code = ddlProject.SelectedValue;
                                        //}

                                        if (ddlStoreName.SelectedValue != "0")
                                        {
                                            newBuyCentral.Store_Code = ddlStoreName.SelectedValue.ToString();
                                        }

                                        //if (ddlStoreUnit.SelectedValue != "0")
                                        //{
                                        //    newBuyCentral.Store_Unit_Id = Convert.ToInt16(ddlStoreUnit.SelectedValue);
                                        //}

                                        //DropDownList drpumCheck1 = (DropDownList)gvRow.FindControl("drpumCkeck");
                                        //DropDownList drpRecieptConditio1n = (DropDownList)gvRow.FindControl("ddlRecieptCondition");

                                        newBuyCentral.StyleSize = _invProduct.StyleAndSize;
                                        //newBuyCentral.FloorName = rchallan.FloorName;
                                        newBuyCentral.UnitName        = _invProduct.UnitName;
                                        newBuyCentral.ReceiveQuantity = ReceiveQty;// Convert.ToInt32(purchaseorder.OrderedQty);
                                        //newBuyCentral.CPU = rchallan.CPU;
                                        //newBuyCentral.RPU = rchallan.RPU;
                                        //newBuyCentral.ExpireDate = rchallan.ExpireDate;
                                        newBuyCentral.BalanceQuanity = ReceiveQty;// Convert.ToInt32(purchaseorder.OrderedQty);
                                        try
                                        {
                                            newBuyCentral.PurchaseDate = DateTime.Now;
                                        }
                                        catch
                                        {
                                            newBuyCentral.PurchaseDate = DateTime.Today;
                                        }

                                        newBuyCentral.EditDate = DateTime.Now;
                                        newBuyCentral.EditUser = ((SessionUser)Session["SessionUser"]).UserId;
                                        newBuyCentral.OCode    = ((SessionUser)Session["SessionUser"]).OCode;
                                        buyCentralBll.Insert(newBuyCentral);
                                    }

                                    else
                                    {
                                        buyCentral.BalanceQuanity = buyCentral.BalanceQuanity + ReceiveQty;// Convert.ToInt32(purchaseorder.OrderedQty);
                                        //buyCentral.CPU = rchallan.CPU;
                                        //buyCentral.RPU = rchallan.RPU;
                                        //buyCentral.ExpireDate = rchallan.ExpireDate;
                                        buyCentral.ReceiveQuantity = buyCentral.ReceiveQuantity + ReceiveQty;// Convert.ToInt32(purchaseorder.OrderedQty);
                                        buyCentralBll.Update(buyCentral, Convert.ToInt32(buyCentral.Id));
                                    }
                                    //}
                                    Inv_RChallan rchallan = new Inv_RChallan();
                                    rchallan.ChallanNo   = ChalanNo;
                                    rchallan.PO_No       = lblPO.Text;
                                    rchallan.ChallanDate = DateTime.Now;
                                    //   rchallan.CompanyId = Convert.ToInt32(ddlCompanyCode.SelectedValue);
                                    rchallan.CompanyCode  = HiddenCompanyCode.Value;
                                    rchallan.CompanyName  = HiddenCompanyName.Value;
                                    rchallan.Barcode      = hdnBarCode.Value;
                                    rchallan.ProductId    = _invProduct.ProductId;
                                    rchallan.ProductGroup = _invProduct.GroupId;
                                    rchallan.ProductName  = _invProduct.ProductName;
                                    rchallan.Brand        = _invProduct.Brand;

                                    //if (ddlProject.SelectedValue != "0")
                                    //{

                                    //    rchallan.Project_Code = ddlProject.SelectedValue;
                                    //}

                                    if (ddlStoreName.SelectedValue != "0")
                                    {
                                        rchallan.Store_Code = ddlStoreName.SelectedValue.ToString();
                                    }
                                    //if (ddlStoreUnit.SelectedValue != "0")
                                    //{
                                    //    rchallan.Store_Unit_Id = Convert.ToInt16(ddlStoreUnit.SelectedValue);
                                    //}

                                    //DropDownList drpumCheck11 = (DropDownList)gvRow.FindControl("drpumCkeck");
                                    //DropDownList drpRecieptConditio11n = (DropDownList)gvRow.FindControl("ddlRecieptCondition");

                                    //if (drpumCheck11.SelectedValue != "0")
                                    //{
                                    //    rchallan.Unit_Cheked = drpumCheck11.SelectedItem.Text;
                                    //}

                                    //if (drpRecieptConditio11n.SelectedValue != "0")
                                    //{
                                    //    rchallan.Reciept_Condition = drpRecieptConditio11n.SelectedItem.Text;
                                    //}

                                    rchallan.Remarks = ItemsRemark;

                                    //rchallan.StyleSize = rchallan.StyleSize;
                                    //rchallan.FloorName = rchallan.FloorName;
                                    rchallan.UnitName        = _invProduct.UnitName;
                                    rchallan.ReceiveQuantity = ReceiveQty;// Convert.ToInt32(purchaseorder.OrderedQty);
                                    //rchallan.CPU = rchallan.CPU;
                                    //rchallan.RPU = rchallan.RPU;
                                    //rchallan.ExpireDate = rchallan.ExpireDate;
                                    rchallan.BalanceQty = rchallan.BalanceQty;
                                    try
                                    {
                                        rchallan.PurchaseDate = DateTime.Today;
                                    }
                                    catch
                                    {
                                        rchallan.PurchaseDate = DateTime.Today;
                                    }

                                    rchallan.EditDate = DateTime.Now;
                                    rchallan.EditUser = ((SessionUser)Session["SessionUser"]).UserId;
                                    rchallan.Ocode    = ((SessionUser)Session["SessionUser"]).OCode;
                                    rChallanBll.Insert(rchallan);
                                    //  string Po = lblPO.Text;

                                    //   PurchaseOrderBll.PurchaseDone(id);
                                    //if (lastReceive == 0 && ReceiveQty == Convert.ToDouble(lblOrderQty.Text))
                                    //{
                                    //    PurchaseOrderBll.PurchaseDoneByPO(id);
                                    //    // PurchaseOrderBll.UpdateLastQty(id, ReceiveQty);
                                    //}
                                    //else if ((Convert.ToDouble(lblOrderQty.Text) == ReceiveQty + Convert.ToInt16(lastReceive)))
                                    //{
                                    //    PurchaseOrderBll.PurchaseDoneByPO(id);
                                    //    // PurchaseOrderBll.UpdateLastQty(id, ReceiveQty);
                                    //}
                                    //else
                                    //{
                                    //    ReceiveQty = ReceiveQty + Convert.ToDouble(lastReceive);
                                    //PurchaseOrderBll.UpdatePOLastQty(id, ReceiveQty);
                                    //}

                                    // lblMessage.Text = "<font color='green'>Purchase information posted successfully</font>";
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Purchase information posted successfully')", true);
                                    SetGriview();
                                    //}
                                }
                            }
                        }
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Select Items')", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Beispiel #6
0
        internal int Enter_VoucherDetails(string OCODE, string Company_Code, string Edit_User, string ModuleName, string ModuleType, string VoucherType, string IdentitiNo, Inv_RChallan rChallan_Obj)
        {
            try
            {
                decimal Amount = 0;
                Amount = Convert.ToDecimal(Amount) + (Convert.ToDecimal(rChallan_Obj.CPU) * Convert.ToDecimal(rChallan_Obj.ReceiveQuantity));

                var Amount_       = new SqlParameter("@Amount", Amount);
                var ModuleName_   = new SqlParameter("@ModuleName", ModuleName);
                var VoucherType_  = new SqlParameter("@VoucherType", VoucherType);
                var Edit_User_    = new SqlParameter("@Edit_User", Edit_User);
                var Company_Code_ = new SqlParameter("@Company_Code", Company_Code);
                var OCode_        = new SqlParameter("@OCode", OCODE);
                var ItemCode_     = new SqlParameter("@ItemCode", ModuleType);
                var Identity      = new SqlParameter("@IdentificationNo", IdentitiNo);

                string SP_SQL = "Vch_Enter_AC_VoucherDetails_by_Module  @Amount,@ModuleName,@VoucherType,@Edit_User,@Company_Code,@OCode,@ItemCode,@IdentificationNo";
                return(_context.ExecuteStoreCommand(SP_SQL, Amount_, ModuleName_, VoucherType_, Edit_User_, Company_Code_, OCode_, ItemCode_, Identity));
            }
            catch (Exception)
            {
                throw;
            }
        }
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string challanNo = txtChalanNo.Text.Trim();

                //string CType = hiddenCompanyType.Value;
                string CType = "CENTRAL";
                if (CType == "CENTRAL")
                {
                    Inv_BuyCentral buyCentral = buyCentralBll.GetBuyCentralByCompanyAndBarcode(hdnBarCode.Value, ddlCompanyCode.SelectedValue.ToString());
                    if (buyCentral == null)
                    { // Insert New
                        Inv_BuyCentral newBuyCentral = new Inv_BuyCentral();
                        newBuyCentral.ChallanNo    = txtChalanNo.Text;
                        newBuyCentral.CompanyId    = Convert.ToInt32(ddlCompanyCode.SelectedValue);
                        newBuyCentral.CompanyCode  = HiddenCompanyCode.Value;
                        newBuyCentral.CompanyName  = HiddenCompanyName.Value;
                        newBuyCentral.BarCode      = hdnBarCode.Value;
                        newBuyCentral.ProductId    = int.Parse(hdnBarCode.Value.ToString());
                        newBuyCentral.ProductGroup = int.Parse(HiddenProductGroup.Value.ToString());
                        newBuyCentral.ProductName  = txtProduct.Text;
                        newBuyCentral.Brand        = txtBrand.Text;

                        //newBuyCentral.StyleSize = rchallan.StyleSize;
                        //newBuyCentral.FloorName = rchallan.FloorName;
                        newBuyCentral.UnitName        = txtUnit.Text;
                        newBuyCentral.ReceiveQuantity = Convert.ToInt32(txtRecQty.Text.Trim());
                        //newBuyCentral.CPU = rchallan.CPU;
                        //newBuyCentral.RPU = rchallan.RPU;
                        //newBuyCentral.ExpireDate = rchallan.ExpireDate;
                        //newBuyCentral.BalanceQuanity = rchallan.BalanceQty;
                        try
                        {
                            newBuyCentral.PurchaseDate = DateTime.Parse(txtDate.Text);
                        }
                        catch
                        {
                            newBuyCentral.PurchaseDate = DateTime.Today;
                        }

                        newBuyCentral.EditDate = DateTime.Now;
                        newBuyCentral.EditUser = ((SessionUser)Session["SessionUser"]).UserId;
                        newBuyCentral.OCode    = ((SessionUser)Session["SessionUser"]).OCode;
                        buyCentralBll.Insert(newBuyCentral);
                    }
                    else
                    {
                        buyCentral.BalanceQuanity = buyCentral.BalanceQuanity + Convert.ToInt32(txtRecQty.Text.Trim());
                        //buyCentral.CPU = rchallan.CPU;
                        //buyCentral.RPU = rchallan.RPU;
                        //buyCentral.ExpireDate = rchallan.ExpireDate;
                        buyCentral.ReceiveQuantity = buyCentral.ReceiveQuantity + Convert.ToInt32(txtRecQty.Text.Trim());
                        buyCentralBll.Update(buyCentral, Convert.ToInt32(buyCentral.Id));
                    }

                    Inv_RChallan rchallan = new Inv_RChallan();
                    rchallan.ChallanNo    = txtChalanNo.Text;
                    rchallan.CompanyId    = Convert.ToInt32(ddlCompanyCode.SelectedValue);
                    rchallan.CompanyCode  = HiddenCompanyCode.Value;
                    rchallan.CompanyName  = HiddenCompanyName.Value;
                    rchallan.Barcode      = hdnBarCode.Value;
                    rchallan.ProductId    = int.Parse(hdnBarCode.Value.ToString());
                    rchallan.ProductGroup = int.Parse(HiddenProductGroup.Value.ToString());
                    rchallan.ProductName  = txtProduct.Text;
                    rchallan.Brand        = txtBrand.Text;
                    //rchallan.StyleSize = rchallan.StyleSize;
                    //rchallan.FloorName = rchallan.FloorName;
                    rchallan.UnitName        = txtUnit.Text;
                    rchallan.ReceiveQuantity = Convert.ToInt32(txtRecQty.Text.Trim());
                    //rchallan.CPU = rchallan.CPU;
                    //rchallan.RPU = rchallan.RPU;
                    //rchallan.ExpireDate = rchallan.ExpireDate;
                    //rchallan.BalanceQuanity = rchallan.BalanceQty;
                    try
                    {
                        rchallan.PurchaseDate = DateTime.Parse(txtDate.Text);
                    }
                    catch
                    {
                        rchallan.PurchaseDate = DateTime.Today;
                    }

                    rchallan.EditDate = DateTime.Now;
                    rchallan.EditUser = ((SessionUser)Session["SessionUser"]).UserId;
                    rchallan.Ocode    = ((SessionUser)Session["SessionUser"]).OCode;
                    rChallanBll.Insert(rchallan);
                    PurchaseOrderBll.PurchaseDone(txtPOrderNo.Text);
                    LoadPurchaseOrders();
                    // lblMessage.Text = "<font color='green'>Purchase information posted successfully</font>";
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Purchase information posted successfully')", true);
                    GenerateReport();
                    ClearForm();
                }
                else // obsolete // hiddenCompanyType = General
                {
                    Inv_Buy buy = buyBll.GetBuyByCompanyAndBarcode(hdnBarCode.Value, ddlCompanyCode.SelectedValue.ToString());

                    if (buy == null)
                    { // Insert New
                        Inv_Buy invBuy = new Inv_Buy();

                        invBuy.ChallanNo    = txtChalanNo.Text;
                        invBuy.CompanyId    = Convert.ToInt32(ddlCompanyCode.SelectedValue);
                        invBuy.CompanyCode  = HiddenCompanyCode.Value;
                        invBuy.CompanyName  = HiddenCompanyName.Value;
                        invBuy.BarCode      = hdnBarCode.Value;
                        invBuy.ProductId    = int.Parse(hdnBarCode.Value.ToString());
                        invBuy.ProductGroup = int.Parse(HiddenProductGroup.Value.ToString());
                        invBuy.ProductName  = txtProduct.Text;
                        invBuy.Brand        = txtBrand.Text;
                        //newBuyCentral.StyleSize = rchallan.StyleSize;
                        //newBuyCentral.FloorName = rchallan.FloorName;
                        invBuy.UnitName        = txtUnit.Text;
                        invBuy.ReceiveQuantity = Convert.ToInt32(txtRecQty.Text.Trim());
                        //newBuyCentral.CPU = rchallan.CPU;
                        //newBuyCentral.RPU = rchallan.RPU;
                        //newBuyCentral.ExpireDate = rchallan.ExpireDate;
                        //newBuyCentral.BalanceQuanity = rchallan.BalanceQty;
                        try
                        {
                            invBuy.PurchaseDate = DateTime.Parse(txtDate.Text);
                        }
                        catch
                        {
                            invBuy.PurchaseDate = DateTime.Today;
                        }

                        invBuy.EditDate = DateTime.Now;
                        invBuy.EditUser = ((SessionUser)Session["SessionUser"]).UserId;
                        invBuy.OCode    = ((SessionUser)Session["SessionUser"]).OCode;
                        buyBll.Insert(invBuy);
                    }
                    else
                    {
                        buy.BalanceQuanity = buy.BalanceQuanity + Convert.ToInt32(txtRecQty.Text.Trim());
                        //buy.CPU = rchallan.CPU;
                        //buy.RPU = rchallan.RPU;
                        //buy.ExpireDate = rchallan.ExpireDate;
                        buy.ReceiveQuantity = buy.ReceiveQuantity + Convert.ToInt32(txtRecQty.Text.Trim());
                        buyBll.Update(buy, Convert.ToInt32(buy.Id));
                    }

                    Inv_RChallan rchallan = new Inv_RChallan();
                    rchallan.ChallanNo    = txtChalanNo.Text;
                    rchallan.CompanyId    = Convert.ToInt32(ddlCompanyCode.SelectedValue);
                    rchallan.CompanyCode  = HiddenCompanyCode.Value;
                    rchallan.CompanyName  = HiddenCompanyName.Value;
                    rchallan.Barcode      = hdnBarCode.Value;
                    rchallan.ProductId    = int.Parse(hdnBarCode.Value.ToString());
                    rchallan.ProductGroup = int.Parse(HiddenProductGroup.Value.ToString());
                    rchallan.ProductName  = txtProduct.Text;
                    rchallan.Brand        = txtBrand.Text;
                    //rchallan.StyleSize = rchallan.StyleSize;
                    //rchallan.FloorName = rchallan.FloorName;
                    rchallan.UnitName        = txtUnit.Text;
                    rchallan.ReceiveQuantity = Convert.ToInt32(txtRecQty.Text.Trim());
                    //rchallan.CPU = rchallan.CPU;
                    //rchallan.RPU = rchallan.RPU;
                    //rchallan.ExpireDate = rchallan.ExpireDate;
                    //rchallan.BalanceQuanity = rchallan.BalanceQty;
                    try
                    {
                        rchallan.PurchaseDate = DateTime.Parse(txtDate.Text);
                    }
                    catch
                    {
                        rchallan.PurchaseDate = DateTime.Today;
                    }

                    rchallan.EditDate = DateTime.Now;
                    rchallan.EditUser = ((SessionUser)Session["SessionUser"]).UserId;
                    rchallan.Ocode    = ((SessionUser)Session["SessionUser"]).OCode;
                    rChallanBll.Insert(rchallan);
                    PurchaseOrderBll.PurchaseDone(txtPOrderNo.Text);
                    LoadPurchaseOrders();
                    //lblMessage.Text = "<font color='green'>Purchase information posted successfully</font>";
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Purchase information posted successfully')", true);
                }
                ClearForm();
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Beispiel #8
0
 internal int Insert(Inv_RChallan rChallanObj)
 {
     return(rChallanDal.Insert(rChallanObj));
 }
Beispiel #9
0
 internal int Enter_VoucherDetails(string OCODE, string Company_Code, string Edit_User, string ModuleName, string ModuleType, string VoucherType, string Identity, Inv_RChallan rChallan_Obj)
 {
     return(rChallanDal.Enter_VoucherDetails(OCODE, Company_Code, Edit_User, ModuleName, ModuleType, VoucherType, Identity, rChallan_Obj));
 }