public int fulfillInsertDisDetail(string itemCode, string disNo)
 {
     var v = (from ddm in entity.Disbursement_Detail
              where ddm.Item_Code == itemCode
              join dm in entity.Disbursements on ddm.Disbursement_ID equals dm.Disbursement_ID
              select new
              {
                  Disbursement_ID = ddm.Disbursement_ID + "F",
                  Item_Code = ddm.Item_Code,
                  Qty_Required = ddm.Qty_Required - ddm.Qty_Disbursed,
                  Qty_Retrieved = ddm.Qty_Required - ddm.Qty_Disbursed,
                  Qty_Disbursed = ddm.Qty_Required - ddm.Qty_Disbursed
              }).FirstOrDefault();
     Disbursement_Detail newDisD = new Disbursement_Detail();
     newDisD.Disbursement_ID = v.Disbursement_ID;
     newDisD.Item_Code = v.Item_Code;
     newDisD.Qty_Retrieved = v.Qty_Retrieved;
     newDisD.Qty_Disbursed = v.Qty_Disbursed;
     entity.Disbursement_Detail.AddObject(newDisD);
     int i = entity.SaveChanges();
     return i;
 }
Пример #2
0
 public int insertDisbursementDetail(Disbursement_Detail ddm)
 {
     int i = eb.insertDisbursementDetail(ddm); return i;
 }
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            rNolist = (List<string>)Session["ReqNoList"];

            foreach (string rN in rNolist) {

                Disbursement newD = new Disbursement();
                string newDisId = d.Generate_ID("Disbursement");
                newD.Disbursement_ID = newDisId;
                newD.Req_Form_No = rN;
                newD.Dept_ID = rN.Substring(0, 3);
                newD.Date = DateTime.Now;
                newD.Disburse_Status = 1;

                eb.insertDis(newD);//--------------eb
                d.update_GenID("Disbursement");
                eb.updateApproval_Status(rN);//----------------eb

                List<Requisition_Detail> rdli = new List<Requisition_Detail>();
                rdli = eb.getItemCodeFromReq(rN);//--------------eb

                foreach (Requisition_Detail rd in rdli) {
                    Disbursement_Detail newDD = new Disbursement_Detail();
                    newDD.Disbursement_ID = newDisId;
                    newDD.Item_Code = rd.Item_Code;
                    newDD.Qty_Required = rd.Qty;

                    int retri_Qty = 0;
                    foreach (GridViewRow row in GridView2.Rows) {
                        if ((row.Cells[1].Text.ToString() == rN) && (row.Cells[0].Text.ToString() == rd.Item_Code))
                        {
                            retri_Qty = int.Parse(row.Cells[3].Text.ToString());
                        }
                        else retri_Qty = 0;
                    }
                    newDD.Qty_Retrieved = retri_Qty;
                    newDD.Qty_Disbursed = retri_Qty;
                    eb.insertDisD(newDD);//-------------eb

                    StockCard_Detail newSD = new StockCard_Detail();
                    string newTranId = d.Generate_ID("StockCard_Detail");
                    newSD.StockCard_ID = eb.getSCIDFromItemCode(rd.Item_Code);//-------------eb
                    newSD.Tran_ID = newTranId;
                    newSD.Emp_ID = "Emp01";
                    newSD.Date = DateTime.Now;
                    newSD.Dept_Supplier = rN.Substring(0, 3);
                    newSD.Qty = - retri_Qty;
                    newSD.Balance = eb.getBalance_From_ItemCode(rd.Item_Code) - retri_Qty;

                    eb.insertStock_Detail(newSD);//-----------------eb
                    d.update_GenID("StockCard_Detail");
                }
            }
        }
 //---------------OutStanding
 public int fulfillOutStanding(string reqNo,string itemCode)
 {
     var v = (from ddm in entity.Disbursement_Detail
              where ddm.Item_Code == itemCode
              join dm in entity.Disbursements on ddm.Disbursement_ID equals dm.Disbursement_ID
              //join rdm in entity.Requisition_Detail on ddm.Item_Code equals rdm.Item_Code
              //where rdm.Req_Form_No == reqNo
              //join dm in entity.Disbursements on rdm.Req_Form_No equals dm.Req_Form_No
              //orderby dm.Date descending
              select new
              {
                  Disbursement_ID = dm.Disbursement_ID + "F",
                  Item_Code = itemCode,
                  Qty_Required = ddm.Qty_Required - ddm.Qty_Disbursed,
                  Qty_Retrieved = ddm.Qty_Required - ddm.Qty_Disbursed,
                  Qty_Disbursed = ddm.Qty_Required - ddm.Qty_Disbursed,
              }).FirstOrDefault();
     Disbursement_Detail newDisD = new Disbursement_Detail();
     newDisD.Disbursement_ID = v.Disbursement_ID;
     newDisD.Item_Code = v.Item_Code;
     newDisD.Qty_Required = v.Qty_Required;
     newDisD.Qty_Retrieved = v.Qty_Retrieved;
     newDisD.Qty_Disbursed = v.Qty_Disbursed;
     entity.Disbursement_Detail.AddObject(newDisD);
     entity.Disbursement_Detail.AddObject(newDisD);
     int i = entity.SaveChanges();
     return i;
 }
 //==========Retrival..........
 public int insertDisD(Disbursement_Detail newDisD)
 {
     entity.Disbursement_Detail.AddObject(newDisD);
     int i = entity.SaveChanges();
     return i;
 }
        /* public List<int> getQtyFromReq(string reqNo) {
            List<int> qtyli = new List<int>();
            var v = from rdm in entity.Requisition_Detail
                    where rdm.Req_Form_No == reqNo
                    select rdm;
        }*/
        //insert/create new row to disbursement detail when click 'Submit at retrieval UI
        //-----------Retrieval
        public int insertDisbursementDetail(string reqNo,string itemCode,string newDisID,int Qty_Req, int Qty_Retrieved)
        {
            var v = (from dm in entity.Disbursements
                     where dm.Req_Form_No == reqNo
                     join rdm in entity.Requisition_Detail on dm.Req_Form_No equals rdm.Req_Form_No
                     where rdm.Item_Code == itemCode
                     select new
                     {
                         Disbursement_ID = newDisID,
                         Item_Code = itemCode,
                         Qty_Required = Qty_Req,
                         Qty_Retrieved = Qty_Retrieved,
                         Qty_Disburse = Qty_Retrieved
                     }).SingleOrDefault();

            Disbursement_Detail newDisD = new Disbursement_Detail();
            newDisD.Disbursement_ID = newDisID;
            newDisD.Item_Code = itemCode;
            newDisD.Qty_Required = Qty_Req;
            newDisD.Qty_Retrieved = Qty_Retrieved;
            newDisD.Qty_Disbursed = Qty_Retrieved;
            entity.Disbursement_Detail.AddObject(newDisD);
            int i = entity.SaveChanges();
            return i;
        }
        //should be update
        public int insertDisbursementDetail(Disbursement_Detail ddm)
        {
            var disbursement_Detail = new Disbursement_Detail
            {
                Item_Code = ddm.Item_Code,
                Qty_Required = ddm.Qty_Required - ddm.Qty_Disbursed,
            };
            entity.Disbursement_Detail.AddObject(disbursement_Detail);

            int i = entity.SaveChanges();
            return i;
        }
        protected void btnFulfil_Click(object sender, EventArgs e)
        {
            foreach (string disNU in disIdUniq) {

                Disbursement newDis = new Disbursement();
                string newDisID = d.Generate_ID("Disbursement");
                newDis.Disbursement_ID = newDisID;
                newDis.Req_Form_No = eb.getReqNo_From_DisID(disNU);//-------------eb
                newDis.Dept_ID = eb.getDeptIdFromDisId(disNU);//--------------eb
                newDis.Date = DateTime.Now;
                newDis.Disburse_Status = 1;
                eb.insertDis(newDis);//-------------eb

                d.update_GenID("Disbursement");

                List<Disbursement_Detail> ddli = new List<Disbursement_Detail>();
                ddli = eb.getDDItemFromDisN(disNU);//-------------eb

                foreach (Disbursement_Detail dd in ddli)
                {
                    foreach (GridViewRow row in GridView1.Rows)
                    {
                        string itemC = row.Cells[1].Text.ToString();
                        if (dd.Item_Code == itemC)
                        {
                            Disbursement_Detail newDD = new Disbursement_Detail();
                            newDD.Disbursement_ID = newDisID;
                            newDD.Item_Code = itemC;
                            newDD.Qty_Required = dd.Qty_Required - dd.Qty_Disbursed;
                            newDD.Qty_Retrieved = dd.Qty_Required - dd.Qty_Disbursed;
                            newDD.Qty_Disbursed = dd.Qty_Required - dd.Qty_Disbursed;
                            eb.insertDisD(newDD);//--------eb
                            eb.updateQty_Disbursed(disNU,itemC);//----------eb

                            StockCard_Detail newSD = new StockCard_Detail();
                            string newTranId = d.Generate_ID("StockCard_Detail");
                            newSD.StockCard_ID = eb.getSCIDFromItemCode(dd.Item_Code);
                            newSD.Tran_ID = newTranId;
                            newSD.Emp_ID = "Emp01";
                            newSD.Date = DateTime.Now;
                            newSD.Dept_Supplier = eb.getDeptIdFromDisId(disNU);
                            newSD.Qty = -(dd.Qty_Required - dd.Qty_Disbursed);
                            newSD.Balance = eb.getBalance_From_ItemCode(dd.Item_Code) - (dd.Qty_Required - dd.Qty_Disbursed);

                            eb.insertStock_Detail(newSD);
                            d.update_GenID("StockCard_Detail");
                        }
                    }
                }

                if (!eb.checkOutS(disNU))//----------eb
                {
                    eb.updateDisburse_Status3to2(disNU);//-----------eb
                }
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Disbursement_Detail EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDisbursement_Detail(Disbursement_Detail disbursement_Detail)
 {
     base.AddObject("Disbursement_Detail", disbursement_Detail);
 }
 /// <summary>
 /// Create a new Disbursement_Detail object.
 /// </summary>
 /// <param name="disbursement_ID">Initial value of the Disbursement_ID property.</param>
 /// <param name="item_Code">Initial value of the Item_Code property.</param>
 public static Disbursement_Detail CreateDisbursement_Detail(global::System.String disbursement_ID, global::System.String item_Code)
 {
     Disbursement_Detail disbursement_Detail = new Disbursement_Detail();
     disbursement_Detail.Disbursement_ID = disbursement_ID;
     disbursement_Detail.Item_Code = item_Code;
     return disbursement_Detail;
 }
Пример #11
0
 public int insertDisD(Disbursement_Detail newDisD)
 {
     return eb.insertDisD(newDisD);
 }
        //insert/create new row to disbursement detail when click 'Submit at retrieval UI
        public int insertDisbursementDetail(Requisition_Detail rdm)
        {
            var disbursement_Detail = new Disbursement_Detail
            {
                Item_Code = rdm.Item_Code,
                Qty_Required = rdm.Qty,
            };
            entity.Disbursement_Detail.AddObject(disbursement_Detail);

            int i = entity.SaveChanges();
            return i;
        }