public ActionResult DeleteConfirmed(int id)
        {
            Inward inward = db.Inwards.Find(id);

            db.Inwards.Remove(inward);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 protected void GrdReport_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     try
     {
         if (e.Row.RowType == DataControlRowType.DataRow)
         {
             SystemOpening     += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "SystemOpening"));
             ActualOpening     += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "ActualOpening"));
             Purchase          += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Purchase"));
             Sales             += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Sales"));
             SalesReturn       += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "SalesReturn"));
             Inward            += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Inward"));
             Outward           += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Outward"));
             OutwardReturn     += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "OutwardReturn"));
             TransferIN        += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "TransferIN"));
             TransferOUT       += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "TransferOUT"));
             Damaged           += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Damage"));
             PurReturn         += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "ReturnToSupplier"));
             Deviation         += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Deviation"));
             SystemClosing     += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "SystemClosing"));
             ActualClosing     += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "ActualClosing"));
             SystemAmount      += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "SystemAmount"));
             ActualAmount      += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "ActualAmount"));
             UNITActualAmount  += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "STOCKINHANDWITHUNITCONVERTSYSTEM"));
             UNITOutwardReturn += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "STOCKINHANDWITHUNITCONVERTACTUAL"));
         }
         if (e.Row.RowType == DataControlRowType.Footer)
         {
             e.Row.Cells[6].Text  = "Total";
             e.Row.Cells[7].Text  = SystemOpening.ToString("0.00");
             e.Row.Cells[8].Text  = ActualOpening.ToString("0.00");
             e.Row.Cells[9].Text  = Purchase.ToString("0.00");
             e.Row.Cells[11].Text = Sales.ToString("0.00");
             e.Row.Cells[12].Text = SalesReturn.ToString("0.00");
             e.Row.Cells[13].Text = Inward.ToString("0.00");
             e.Row.Cells[14].Text = Outward.ToString("0.00");
             e.Row.Cells[15].Text = OutwardReturn.ToString("0.00");
             e.Row.Cells[16].Text = TransferIN.ToString("0.00");
             e.Row.Cells[17].Text = TransferOUT.ToString("0.00");
             e.Row.Cells[18].Text = Damaged.ToString("0.00");
             e.Row.Cells[10].Text = PurReturn.ToString("0.00");
             e.Row.Cells[19].Text = Deviation.ToString("0.00");
             e.Row.Cells[20].Text = SystemClosing.ToString("0.00");
             e.Row.Cells[21].Text = ActualClosing.ToString("0.00");
             e.Row.Cells[23].Text = UNITActualAmount.ToString("0.00");
             e.Row.Cells[24].Text = UNITOutwardReturn.ToString("0.00");
             e.Row.Cells[25].Text = SystemAmount.ToString("0.00");
             e.Row.Cells[26].Text = ActualAmount.ToString("0.00");
         }
     }
     catch (Exception ex)
     {
     }
 }
 public ActionResult Edit([Bind(Include = "InwardID,DateOfReciept,FromWhereRec,NoOfLett,DateOfLett,FileNo,SubjectMatter,ActionTaken,Remark,RegisterTypeID")] Inward inward)
 {
     if (ModelState.IsValid)
     {
         db.Entry(inward).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", new { rt = inward.RegisterTypeID }));
     }
     ViewBag.RegisterTypeID = inward.RegisterTypeID;
     return(View(inward));
 }
        public static bool SaveInward(Inward Inward)
        {
            Dictionary <string, object> param = new Dictionary <string, object>();

            param.Add("@ID", Inward.ID);
            param.Add("@InwardNo", Inward.InwardNo);
            param.Add("@InwardDate", Inward.InwardDate);
            param.Add("@PartyID", Inward.PartyID);
            param.Add("@PaymentNarr", Inward.PaymentNarr);
            param.Add("@DeliveryNarr", Inward.DeliveryNarr);
            param.Add("@BillingNarr", Inward.BillingNarr);
            param.Add("@Remarks1", Inward.Remarks1);
            param.Add("@Remarks2", Inward.Remarks2);
            param.Add("@Total", Inward.Total);
            param.Add("@CreatedBy", Inward.CreatedBy);
            param.Add("@UpdatedBy", Inward.UpdatedBy);

            DataTable dt = new DataTable();

            dt.TableName = "[dbo].[InwardDetail]";
            dt.Columns.Add("ID", typeof(int));
            dt.Columns.Add("InwardID", typeof(int));
            dt.Columns.Add("ProductID", typeof(int));
            dt.Columns.Add("Qty", typeof(string));
            dt.Columns.Add("Rate", typeof(string));
            dt.Columns.Add("Total", typeof(string));

            if (Inward.inwardDetail != null && Inward.inwardDetail.Count > 0)
            {
                foreach (var detail in Inward.inwardDetail)
                {
                    dt.Rows.Add();
                    dt.Rows[dt.Rows.Count - 1]["ID"]        = detail.ID;
                    dt.Rows[dt.Rows.Count - 1]["InwardID"]  = detail.InwardID;
                    dt.Rows[dt.Rows.Count - 1]["ProductID"] = detail.ProductID;
                    dt.Rows[dt.Rows.Count - 1]["Qty"]       = (detail.IsDeleted ? "0" : detail.Qty);
                    dt.Rows[dt.Rows.Count - 1]["Rate"]      = detail.Rate;
                    dt.Rows[dt.Rows.Count - 1]["Total"]     = detail.Total;
                }
            }

            param.Add("@InwardDetails", dt);

            if (DBHelper.ExecuteNonQuery("SaveInward", param, true) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public ActionResult Create([Bind(Include = "InwardID,DateOfReciept,FromWhereRec,NoOfLett,DateOfLett,FileNo,SubjectMatter,ActionTaken,Remark,RegisterTypeID")] Inward inward)
        {
            ViewBag.RegisterTypeID = inward.RegisterTypeID;
            if (ModelState.IsValid)
            {
                db.Inwards.Add(inward);
                db.SaveChanges();
                return(RedirectToAction("Index", new { rt = inward.RegisterTypeID }));
            }


            return(View(inward));
        }
        // GET: Search/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Inward inward = db.Inwards.Find(id);

            if (inward == null)
            {
                return(HttpNotFound());
            }
            return(View(inward));
        }
Exemple #7
0
        public ActionResult Add(Inward inward)
        {
            ResponseMsg response = new ResponseMsg();

            inward.CreatedBy = inward.UpdatedBy = currUser.ID;
            if (InwardLogic.SaveInward(inward))
            {
                response.IsSuccess = true;
            }
            else
            {
                response.IsSuccess = false;
            }
            return(Json(response));
        }
        // GET: Inwards/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Inward inward = db.Inwards.Find(id);

            ViewBag.RegisterTypeID = inward.RegisterTypeID;

            if (inward == null)
            {
                return(HttpNotFound());
            }
            return(View(inward));
        }
 public bool addInward(Inward entity)
 {
     try
     {
         var inward = new Inward();
         inward.TotalQuantity = entity.TotalQuantity;
         inward.TotalAmount   = entity.TotalAmount;
         inward.Createdate    = DateTime.Now;
         db.Inwards.Add(inward);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
        //PUT: api/Unit/5
        public ServerResponse Put([FromBody] Inward Inward)
        {
            var res = new ServerResponse();

            using (InwardBL InwardBL = new InwardBL())
            {
                try
                {
                    res.Data = InwardBL.UpdateInward(Inward);
                }

                catch (Exception ex)
                {
                    res.Success = false;
                }
            }
            return(res);
        }
 protected void GrdReport_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     try
     {
         if (e.Row.RowType == DataControlRowType.DataRow)
         {
             Opening       += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Opening"));
             Purchase      += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Purchase"));
             Sales         += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Sales"));
             SalesReturn   += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "SalesReturn"));
             Inward        += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Inward"));
             Outward       += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Outward"));
             OutwardReturn += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "OutwardReturn"));
             TransferIN    += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "TransferIN"));
             TransferOUT   += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "TransferOUT"));
             Damaged       += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Damage"));
             PurReturn     += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "ReturnToSupplier"));
             Closing       += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Closing"));
             Amount        += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Amount"));
             Consumption   += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Consumption"));
         }
         if (e.Row.RowType == DataControlRowType.Footer)
         {
             e.Row.Cells[6].Text  = "Total";
             e.Row.Cells[7].Text  = Opening.ToString("0.00");
             e.Row.Cells[8].Text  = Purchase.ToString("0.00");
             e.Row.Cells[9].Text  = Sales.ToString("0.00");
             e.Row.Cells[10].Text = SalesReturn.ToString("0.00");
             e.Row.Cells[12].Text = Inward.ToString("0.00");
             e.Row.Cells[13].Text = Outward.ToString("0.00");
             e.Row.Cells[14].Text = OutwardReturn.ToString("0.00");
             e.Row.Cells[16].Text = TransferIN.ToString("0.00");
             e.Row.Cells[17].Text = TransferOUT.ToString("0.00");
             e.Row.Cells[15].Text = Damaged.ToString("0.00");
             e.Row.Cells[11].Text = PurReturn.ToString("0.00");
             e.Row.Cells[19].Text = Closing.ToString("0.00");
             e.Row.Cells[20].Text = Amount.ToString("0.00");
             e.Row.Cells[18].Text = Consumption.ToString("0.00");
         }
     }
     catch (Exception ex)
     {
     }
 }
Exemple #12
0
        public ActionResult AddInward(Inward entity)
        {
            var res = new InwardBusiness().addInward(entity);

            if (res)
            {
                var cart = (List <CartDTO>)Session["add_inward"];
                foreach (var item in cart)
                {
                    var detail = new Inward_Detail();
                    detail.Inward_ID  = db.Inwards.Max(x => x.ID);
                    detail.Product_ID = item.Product.ID;
                    detail.Quantity   = item.Quantity;

                    if (item.Product.Price != null)
                    {
                        detail.Price  = item.Product.Price;
                        detail.Amount = (int)item.Product.Price * item.Quantity;
                    }
                    else
                    {
                        detail.Price  = item.Product.Promotion_Price;
                        detail.Amount = (int)item.Product.Promotion_Price * item.Quantity;
                    }
                    new InwardBusiness().addInward_Detail(detail);

                    //Cộng tồn kho
                    new ProductBusiness().AddQuantity(item.Product.ID, item.Quantity);
                }
                Session["add_order"]    = null;
                TempData["add_success"] = "Nhập kho thành công.";
                return(RedirectToAction("Index"));
            }
            else
            {
                return(RedirectToAction("Add"));
            }
        }
Exemple #13
0
        public IEnumerable <Inward> GetDataByQueryCondition(QueryCondition queryCondition)
        {
            var storedProcedure = "Proc_Inward_GetByCondition";
            var parameter       = new Hashtable();

            if (queryCondition.ShopID == null)
            {
                parameter.Add("ShopID", DBNull.Value);
            }
            else
            {
                parameter.Add("ShopID", queryCondition.ShopID);
            }
            parameter.Add("StartDate", queryCondition.StartDate.ToLocalTime());
            parameter.Add("EndDate", queryCondition.EndDate.ToLocalTime());

            using (DataAccess dataAccess = new DataAccess())
            {
                SqlDataReader dataReader = dataAccess.ExecuteReader(storedProcedure, parameter);

                while (dataReader.Read())
                {
                    var item = new Inward();
                    for (int i = 0; i < dataReader.FieldCount; i++)
                    {
                        var fieldTableName  = dataReader.GetName(i);
                        var fieldTableValue = dataReader.GetValue(i);
                        var property        = item.GetType().GetProperty(fieldTableName);
                        if (property != null && fieldTableValue != DBNull.Value)
                        {
                            property.SetValue(item, fieldTableValue);
                        }
                    }
                    yield return(item);
                }
            }
        }
        public ActionResult updatedetails(sample_User samp, FormCollection frm)
        {
            using (var database = new TapalsEntities())
            {
                // var tplno = database.Inwards.Max(hc => hc.TPLNO) + 1;
                var chequeList = new List <in_Cheque>();

                foreach (var key in frm.AllKeys.Where(hc => hc.Contains("MyKey")).ToList())
                {
                    var       myKey = key.Replace("MyKey", "");
                    in_Cheque check = new in_Cheque()
                    {
                        AMOUNT = frm["AMOUNT" + myKey],
                        BANK   = frm["BANK" + myKey],
                        CQDATE = (Convert.ToDateTime(frm["CQDATE" + myKey])),
                        CQNO   = Convert.ToInt64(frm["CQNO" + myKey]),
                        //TPLNO = Convert.ToInt32(tplno + myKey)
                        // TPLNO = tplno + myKey
                    };
                    chequeList.Add(check);
                }

                if (chequeList != null && chequeList.Any())
                {
                    using (var dbobj = new TapalsEntities())
                    {
                        foreach (var cheque in chequeList)
                        {
                            bool isrecordexist = false;
                            var  dbtable       = dbobj.Cheques.SingleOrDefault(hc => hc.CQNO == cheque.CQNO);
                            if (dbtable != null)
                            {
                                isrecordexist = true;
                            }
                            else
                            {
                                dbtable = new Cheque();
                            }

                            dbtable.AMOUNT = cheque.AMOUNT;
                            dbtable.BANK   = cheque.BANK;
                            dbtable.CQDATE = cheque.CQDATE;
                            dbtable.CQNO   = Convert.ToInt32(cheque.CQNO);
                            //dbtable.TPLNO = tplno1;
                            if (!isrecordexist)
                            {
                                dbobj.Cheques.Add(dbtable);
                            }
                            dbobj.SaveChanges();
                        }
                    }
                }

                using (var dbobj = new TapalsEntities())
                {
                    bool isrecordexist = false;
                    var  dbtable       = dbobj.Inwards.SingleOrDefault(hc => hc.TPLNO == samp.TPLNO);
                    if (dbtable != null)
                    {
                    }
                    else
                    {
                        string dep = frm["Department"];
                        dbtable           = new Inward();
                        dbtable.Date_in   = DateTime.Now;
                        dbtable.T_Sno     = samp.T_Sno;
                        dbtable.T_From    = samp.T_From;
                        dbtable.T_Dept    = frm["Department"];
                        dbtable.T_Subject = samp.T_Subject;
                        dbtable.T_Section = samp.T_Section;
                        dbtable.T_Passout = samp.T_Passout;
                        dbtable.TPLNO     = "I1526";
                        dbtable.T_Cheque  = "Y";
                        //  dbtable.T_User = Session["UserName"].ToString();
                        dbtable.T_User = "******";
                        dbtable.wfcpno = samp.wfcpno;
                    }
                    if (!isrecordexist)
                    {
                        dbobj.Inwards.Add(dbtable);
                    }

                    dbobj.SaveChanges();
                }
                return(RedirectToAction("Index", "New_Entry"));
            }
        }
Exemple #15
0
        public Inward UpdateInward(Inward Inward)
        {
            var result = this.UpdateEntity <Inward>(Inward);

            return(result);
        }
Exemple #16
0
        public ActionResult Create(sample_User samp, FormCollection frm)
        {
            using (var database = new TapalsEntities())
            {
                var chequeList = new List <in_Cheque>();
                if (frm.AllKeys.Any() && frm.AllKeys.Count() > 0)
                {
                    foreach (var key in frm.AllKeys.Where(hc => hc.Contains("MyKey")).ToList())
                    {
                        var       myKey = key.Replace("MyKey", "");
                        in_Cheque check = new in_Cheque()
                        {
                            AMOUNT = frm["AMOUNT" + myKey],
                            BANK   = frm["BANK" + myKey],
                            CQDATE = Convert.ToDateTime(frm["CQDATE" + myKey]),
                            CQNO   = Convert.ToInt64(frm["CQNO" + myKey]),
                        };
                        chequeList.Add(check);
                    }
                }

                if (chequeList != null && chequeList.Any())
                {
                    foreach (var cheque in chequeList)
                    {
                        bool isCheckexist   = false;
                        var  dbCheckDetails = database.Cheques.SingleOrDefault(hc => hc.CQNO == cheque.CQNO);
                        if (dbCheckDetails != null)
                        {
                            isCheckexist = true;
                        }
                        else
                        {
                            dbCheckDetails = new Cheque();
                        }
                        dbCheckDetails.CQNO   = Convert.ToInt32(cheque.CQNO);
                        dbCheckDetails.TPLNO  = (String.Format("{0:ddMMyyyy}", DateTime.Now.Date).Replace(" ", String.Empty)) + (samp.T_Sno);
                        dbCheckDetails.CQDATE = cheque.CQDATE;
                        dbCheckDetails.BANK   = cheque.BANK;
                        dbCheckDetails.AMOUNT = cheque.AMOUNT;
                        if (!isCheckexist)
                        {
                            database.Cheques.Add(dbCheckDetails);
                        }
                        database.SaveChanges();
                    }
                }
                bool   isrecordexist  = false;
                string TapalNo        = string.Empty;
                var    dbInWardDetail = database.Inwards.SingleOrDefault(hc => hc.TPLNO == samp.TPLNO);
                if (dbInWardDetail != null)
                {
                    isrecordexist = true;
                }
                else
                {
                    dbInWardDetail          = new Inward();
                    TapalNo                 = (String.Format("{0:ddMMyyyy}", DateTime.Now.Date).Replace(" ", String.Empty)) + (samp.T_Sno);
                    dbInWardDetail.TPLNO    = TapalNo;
                    dbInWardDetail.T_Sno    = samp.T_Sno;
                    dbInWardDetail.T_Cheque = frm["Check1"] != null ? "Y" : "N";
                    dbInWardDetail.Date_in  = DateTime.Now.Date;
                }
                dbInWardDetail.T_From          = samp.T_From;
                dbInWardDetail.T_Dept          = frm["hdndepartmentDropDown"];
                dbInWardDetail.T_Subject       = samp.T_Subject;
                dbInWardDetail.T_Subject_Value = samp.T_Subject_Value;
                dbInWardDetail.T_Section       = frm["hdnsectionDropdownId"];
                dbInWardDetail.T_User          = "******";
                dbInWardDetail.T_Passout       = samp.T_Passout;
                dbInWardDetail.wfcpno          = samp.wfcpno;
                dbInWardDetail.Issue           = false;
                if (!isrecordexist)
                {
                    database.Inwards.Add(dbInWardDetail);
                }
                database.SaveChanges();
                if (!string.IsNullOrEmpty(TapalNo))
                {
                    TempData["TapalNo"] = TapalNo;
                }
                return(RedirectToAction("Create", "Inward"));
            }
        }