Example #1
0
        public ActionResult GetWBItems(Guid id)
        {
            using (var db = new SCMSEntities())
            {
                WarehouseRelease wrn = db.WarehouseReleases.SingleOrDefault(p => p.Id == id);

                StringBuilder blineOption = new StringBuilder();
                blineOption.Append("<table width=\"95%\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\" border=\"1\" style=\"border: 1px solid grey;");
                blineOption.Append("border-collapse: collapse; padding: 5px; font-size: 12px;\">");
                blineOption.Append("<tr class=\"gridheader\"><th colspan=\"6\" align=\"left\"><h4>" + Resources.WayBill_LoadWB_LOADINGDISPATCHDETAILS + "</h4></th></tr>");
                blineOption.Append("<tr><th style=\"width: 5%; text-align: center;\"></th>");
                blineOption.Append("<th style=\"width: 15%; text-align: center;\">" + Resources.WayBillController_String_ItemSerialNo + "</th>");
                blineOption.Append("<th style=\"width: 28%; text-align: center;\">" + Resources.WayBill_LoadWB_EquipmentitemCommodity + "</th>");
                blineOption.Append("<th style=\"width: 10%; text-align: center;\">" + Resources.Global_String_Unit + "</th>");
                blineOption.Append("<th style=\"width: 17%; text-align: center;\">" + Resources.Global_String_Weight + "</th>");
                blineOption.Append("<th style=\"width: 17%; text-align: center;\">" + Resources.WayBill_LoadWB_QtyDispatched + "</th></tr>");

                if (wrn != null)
                {
                    Int64 count = 1;
                    foreach (WarehouseReleaseItem item in wrn.WarehouseReleaseItems.ToList())
                    {
                        blineOption.Append("<tr><td align=\"center\">" + count + "</td>");
                        if (item.Inventory.Item.ItemCategory.CategoryCode == "C")
                        {
                            blineOption.Append("<td>" + item.Inventory.Item.SerialNumber + "</td>");
                        }
                        else
                        {
                            blineOption.Append("<td>" + db.Assets.First(p => p.Id == item.AssetId).SerialNumber + "</td>");
                        }
                        if (item.Inventory.Item.ItemCategory.CategoryCode == "C")
                        {
                            blineOption.Append("<td>" + item.Inventory.Item.Name + "</td>");
                        }
                        else
                        {
                            blineOption.Append("<td>" + db.Assets.First(p => p.Id == item.AssetId).Name + "</td>");
                        }
                        blineOption.Append("<td>" + item.Inventory.Item.UnitOfMeasure.Code + "</td>");
                        if (item.Inventory.Item.ItemCategory.CategoryCode == "C")
                        {
                            blineOption.Append("<td></td>");
                        }
                        else
                        {
                            blineOption.Append("<td>" + item.Asset.Weight + "</td>");
                        }
                        blineOption.Append("<td>" + item.Quantity + "</td></tr>");
                        count++;
                    }
                }

                blineOption.Append("</table>");
                ViewBag.Html = blineOption.ToString();
                return(View("HTMLResponses"));
            }
        }
Example #2
0
        public ActionResult LoadWRFItem(WarehouseRelease model)
        {
            model.Id                          = Guid.NewGuid();
            model.NotReleased                 = true;
            model.CountryProgrammeId          = countryProg.Id;
            model.PreparedOn                  = DateTime.Now;
            model.PreparedBy                  = currentStaff.Id;
            UserSession.CurrentSession.NewWRN = model;

            return(ReleaseItem(model.Id));
        }
Example #3
0
 public bool SaveApproved(WarehouseRelease wro)
 {
     using (var context = new SCMSEntities())
     {
         context.WarehouseReleases.Attach(wro);
         ((IObjectContextAdapter)context).ObjectContext.ObjectStateManager.ChangeObjectState(wro, System.Data.EntityState.Modified);
         int affectedRecords = context.SaveChanges();
         SessionData.CurrentSession.ReleaseOrderList     = null;
         SessionData.CurrentSession.ReleaseOrderItemList = null;
         return(affectedRecords > 0);
     }
 }
Example #4
0
 public bool EditRO(WarehouseRelease RO)
 {
     using (var context = new SCMSEntities())
     {
         var existing = context.WarehouseReleases.FirstOrDefault(p => p.Id == RO.Id);
         context.Entry(existing).CurrentValues.SetValues(RO);
         int affectedRecords = context.SaveChanges();
         SessionData.CurrentSession.ReleaseOrderList     = null;
         SessionData.CurrentSession.ReleaseOrderItemList = null;
         return(affectedRecords > 0);
     }
 }
Example #5
0
        public ActionResult ReleaseItem(Guid ROId)
        {
            WarehouseRelease rOrder = null;

            rOrder = WRFservice.GetWRNs().FirstOrDefault(k => k.Id == ROId);
            if (rOrder == null)
            {
                rOrder = UserSession.CurrentSession.NewWRN;
            }

            var modal = new WarehouseReleaseItem()
            {
                Items = new SelectList(WRFservice.GetInventoryItems((Guid)rOrder.WareHouseId), "Id", "ItemName"),
                WarehouseReleaseId = ROId
            };

            return(View("LoadWRFItem", modal));
        }
Example #6
0
        public ActionResult WBReceive()
        {
            using (var db = new SCMSEntities())
            {
                WarehouseRelease            wrn  = db.WarehouseReleases.FirstOrDefault <WarehouseRelease>();
                List <WarehouseReleaseItem> itmz = wrn != null?wrn.WarehouseReleaseItems.ToList() : new List <WarehouseReleaseItem>();

                foreach (WarehouseReleaseItem item in itmz)
                {
                    Model.Inventory     iv  = item.Inventory;
                    Model.Item          it  = iv.Item;
                    Model.ItemCategory  itc = it.ItemCategory;
                    Model.Asset         ast = item.Asset;
                    Model.UnitOfMeasure u   = it.UnitOfMeasure;
                }
                //Use this to populate items on load for any changes in the stolen code
                //WayBill wb = db.WayBills.First(p => p.Id == new Guid("0D88562F-BBEC-4722-941B-91FC4D82BB1C"));
                //List<WarehouseReleaseItem> wrnn = db.WarehouseReleases.FirstOrDefault(p => p.Id == wb.WRNId).WarehouseReleaseItems.ToList();
                //foreach (WarehouseReleaseItem item in wrnn)
                //{
                //    Model.Asset ass = item.Asset;
                //    Model.Inventory iv = item.Inventory;
                //    Model.Item it = iv.Item;
                //    Model.ItemCategory ic = it.ItemCategory;
                //    Model.UnitOfMeasure u = it.UnitOfMeasure;
                //}

                var model = new ReceiveWB()
                {
                    EntityWBill   = new WayBill(),
                    IssuingOffice = new SelectList(WBService.GetSubOffices(countryProg.Id), "Id", "Name"),
                    WBlist        = new SelectList(WBService.GetWayBillsNotReceived(countryProg.Id), "Id", "RefNumber"),
                    WRItems       = new List <WarehouseReleaseItem>()//wrnn
                };
                return(View(model));
            }
        }
Example #7
0
        //
        public ActionResult ReleaseForm(Guid WRNid)
        {
            Dictionary <String, String> data = new Dictionary <string, string>();

            using (var db = new SCMSEntities())
            {
                WarehouseRelease wrnenttiy = db.WarehouseReleases.First(p => p.Id == WRNid);

                data.Add("{DATE}", wrnenttiy.RequestDate.ToShortDateString());


                data.Add("{REF_NO}", wrnenttiy.RefNumber);
                data.Add("{OFFICE}", wrnenttiy.Staff1.CountrySubOffice.Name);

                var requestor = db.VStaffDetails.First(p => p.StaffID == wrnenttiy.PreparedBy);
                var recipient = db.VStaffDetails.First(p => p.StaffID == wrnenttiy.ReceivedBy);

                data.Add("{NAME}", requestor.StaffName);
                data.Add("{TITLE}", requestor.Designation);
                if (requestor.SignatureImage.IsNotNull())
                {
                    data.Add("{SIGNATURE}", string.Format("<img src=\"{0}\" alt=\"\" style=\"max-width: 50px;\" />", "data:image/png;base64," + Convert.ToBase64String(requestor.SignatureImage)));
                }

                data.Add("{APPROVER-NAME}", wrnenttiy.IsApproved ? wrnenttiy.Staff.Person.FirstName + " " + wrnenttiy.Staff.Person.OtherNames : "");
                data.Add("{APPROVER-TITLE}", wrnenttiy.IsApproved ? wrnenttiy.Staff.Designation.Name : "");
                data.Add("{APPROVER-OFICE}", wrnenttiy.IsApproved ? wrnenttiy.Staff.CountrySubOffice.Name : "");
                if (wrnenttiy.Staff.Person.SignatureImage.IsNotNull() && wrnenttiy.IsApproved)
                {
                    data.Add("{SIGNATURE2}", string.Format("<img src=\"{0}\" alt=\"\" style=\"max-width: 50px;\" />", "data:image/png;base64," + Convert.ToBase64String(wrnenttiy.Staff.Person.SignatureImage)));
                }

                data.Add("{RECEIVER_NAME}", recipient != null ? recipient.StaffName : "");
                data.Add("{RECEIVER_TITLE}", recipient != null ? recipient.Designation : "");
                data.Add("{RECEIVER_UNIT}", wrnenttiy.Staff2 != null ? wrnenttiy.Staff2.CountrySubOffice.Name : "");
                data.Add("{RECEIVER_DATE}", wrnenttiy.ReceiptDate.ToDDMMyyyHHmm());
                if (wrnenttiy.Staff2.Person.SignatureImage.IsNotNull())
                {
                    data.Add("{RECEIVER_SIGNATURE}", string.Format("<img src=\"{0}\" alt=\"\" style=\"max-width: 100px;\" />", "data:image/png;base64," + Convert.ToBase64String(wrnenttiy.Staff2.Person.SignatureImage)));
                }

                List <Model.WarehouseReleaseItem> writms = wrnenttiy.WarehouseReleaseItems.ToList();
                string tbody = "";
                int    r = 1; string itemName, serialNo, AssetNo;
                foreach (WarehouseReleaseItem item in writms)
                {
                    if (item.Inventory.Item.ItemCategory.CategoryCode == "C")
                    {
                        itemName = item.Inventory.Item.Name;
                        serialNo = item.Inventory.Item.SerialNumber;
                        AssetNo  = "N/A";
                    }
                    else
                    {
                        itemName = item.Asset.Name;
                        serialNo = item.Asset.SerialNumber;
                        AssetNo  = item.Asset.AssetNumber;
                    }
                    tbody += "<tr><td>" + r++ + "</td><td>";
                    tbody += itemName + "</td><td>";
                    tbody += item.Inventory.Item.UnitOfMeasure.Code + "</td><td>";
                    tbody += serialNo + "</td><td>";
                    tbody += AssetNo + "</td><td>";
                    tbody += item.Quantity + "</td><td>";
                    tbody += item.Comments + "</td></tr>";
                }
                while (r < 21)
                {
                    tbody += "<tr><td>" + r++ + "</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>";
                }
                data.Add("{DETAILS}", tbody);
                List <String> options = new List <string>();
                options.Add(" --copies 2 ");
                Byte[] output = WkHtml2Pdf.CreateReport(data, "warehouse-release-form.html", options);

                return(File(output, "application/pdf", "WRN_" + DateTime.Now.FormatDDMMMYYYYHHmm()));
            }
        }
Example #8
0
        public ActionResult GetWBReceivdItems(Guid id)
        {
            using (var db = new SCMSEntities())
            {
                WayBill          wb          = db.WayBills.First(p => p.Id == id);
                WarehouseRelease wrn         = db.WarehouseReleases.FirstOrDefault(p => p.Id == wb.WRNId);
                StringBuilder    blineOption = new StringBuilder();
                blineOption.Append("<table width=\"98%\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\" border=\"1\" style=\"border: 1px solid grey;");
                blineOption.Append("border-collapse: collapse; padding: 5px; font-size: 12px;\">");
                blineOption.Append("<tr class=\"gridheader\"><th colspan=\"8\" align=\"left\"><h4>" + Resources.WayBill_ViewWBDetails_WayBillDetails + "</h4></th></tr>");
                blineOption.Append("<tr><th style=\"width: 5%; text-align: center;\"></th>");
                blineOption.Append("<th style=\"width: 15%; text-align: center;\">" + Resources.WayBillController_String_ItemSerialNo + "</th>");
                blineOption.Append("<th style=\"width: 20%; text-align: center;\">" + Resources.WayBill_LoadWB_EquipmentitemCommodity + "</th>");
                blineOption.Append("<th style=\"width: 8%; text-align: center;\">" + Resources.Global_String_Unit + "</th>");
                blineOption.Append("<th style=\"width: 12%; text-align: center;\">" + Resources.Global_String_Weight + "</th>");
                blineOption.Append("<th style=\"width: 12%; text-align: center;\">" + Resources.WayBill_LoadWB_QtyDispatched + "</th>");
                blineOption.Append("<th style=\"width: 10%; text-align: center;\">" + Resources.Global_String_QtyReceived + "</th>");
                blineOption.Append("<th style=\"width: 10%; text-align: center;\">" + Resources.Global_String_QtyDamaged + "</th></tr>");

                if (wrn != null)
                {
                    Int64 count = 1, cunt2 = 0;
                    foreach (WarehouseReleaseItem item in wrn.WarehouseReleaseItems.ToList())
                    {
                        blineOption.Append("<tr><td align=\"center\">" + count + "");
                        blineOption.Append("<input id=\"WRItems_" + cunt2 + "__Id\" name=\"WRItems[" + cunt2 + "].Id\" type=\"hidden\" value=\"" + item.Id + "\" /></td>");
                        if (item.Inventory.Item.ItemCategory.CategoryCode == "C")
                        {
                            blineOption.Append("<td>" + item.Inventory.Item.SerialNumber + "</td>");
                        }
                        else
                        {
                            blineOption.Append("<td>" + db.Assets.First(p => p.Id == item.AssetId).SerialNumber + "</td>");
                        }
                        if (item.Inventory.Item.ItemCategory.CategoryCode == "C")
                        {
                            blineOption.Append("<td>" + item.Inventory.Item.Name + "</td>");
                        }
                        else
                        {
                            blineOption.Append("<td>" + db.Assets.First(p => p.Id == item.AssetId).Name + "</td>");
                        }
                        blineOption.Append("<td>" + item.Inventory.Item.UnitOfMeasure.Code + "</td>");
                        if (item.Inventory.Item.ItemCategory.CategoryCode == "C")
                        {
                            blineOption.Append("<td>N/A</td>");
                        }
                        else
                        {
                            blineOption.Append("<td>" + item.Asset.Weight + "</td>");
                        }
                        blineOption.Append("<td>" + item.Quantity + "</td>");

                        blineOption.Append("<td><input class=\"WBnumericTb\" data-val=\"true\" data-val-number=\"" + Resources.Global_String_InvalidValue + "\" ");
                        blineOption.Append("data-val-required=\"" + Resources.Global_String_Required + "\" id=\"WRItems_" + cunt2 + "__QuantityReceived\" name=\"WRItems[" + cunt2 + "].QuantityReceived\" type=\"text\" value=\"\" />");
                        blineOption.Append("<span class=\"field-validation-valid\" data-valmsg-for=\"WRItems[" + cunt2 + "].QuantityReceived\" data-valmsg-replace=\"true\"></span></td>");

                        blineOption.Append("<td><input class=\"WBnumericTb\" data-val=\"true\" data-val-number=\"" + Resources.Global_String_InvalidValue + "\" ");
                        blineOption.Append("data-val-required=\"" + Resources.Global_String_Required + "\" id=\"WRItems_" + cunt2 + "__QuantityDamaged\" name=\"WRItems[" + cunt2 + "].QuantityDamaged\" type=\"text\" value=\"\" />");
                        blineOption.Append(" <span class=\"field-validation-valid\" data-valmsg-for=\"WRItems[" + cunt2 + "].QuantityDamaged\" data-valmsg-replace=\"true\"></span></td></tr>");

                        count++; cunt2++;
                    }
                }

                blineOption.Append("</table>");
                ViewBag.Html = blineOption.ToString();
                return(View("HTMLResponses"));
            }
        }