Example #1
0
        public ActionResult Bill(int id, ItemTypesEnum ite)
        {
            ViewBag.Order = db.Single <OrderTicket>(id);
            PetaPoco.Sql sq = new PetaPoco.Sql("Select od.*, ItemName from orderTicketDetails od, Items i where od.itemId=i.ItemId and OTID=@0", id);

            switch (ite)
            {
            case ItemTypesEnum.DrinksNAlc:
            {
                sq.Append(" and i.itemTypeId <>@0", ItemTypesEnum.DrinksAlc);
                break;
            }

            case ItemTypesEnum.DrinksAlc:
            {
                sq.Append(" and i.itemTypeId =@0", ItemTypesEnum.DrinksAlc);
                break;
            }

            default:
                break;
            }

            ViewBag.orderDetails = db.Query <OrderDetailsVw>(sq);
            return(View());
        }
Example #2
0
        public ActionResult Index(int?page, ItemTypesEnum Ite, string PropName)
        {
            if (PropName?.Length > 0)
            {
                page = 1;
            }
            ViewBag.iteName = db.ExecuteScalar <string>("Select ItemTypeName from ItemTypes where ItemTypeId=@0", (int)Ite);
            ViewBag.ite     = Ite;
            int ItemTypeId = (int)Ite;

            return(View("Index", base.BaseIndex <ItemsVw>(page, "ItemID, ItemName, ItemTypeName as Type, ExpiryDays, UnitName as Unit", $"Items i, Units u, ItemTypes t where i.ItemTypeId=t.ItemTypeId and i.itemTypeId = {ItemTypeId} and i.UnitID=u.UnitID and ItemName like '%" + PropName + "%'")));
        }
Example #3
0
 public ActionResult Receipt(int LocationId, int?page, ItemTypesEnum Ite, string PropName, DateTime?EDate)
 {
     if (PropName?.Length > 0)
     {
         page = 1;
     }
     ViewBag.iteName      = db.ExecuteScalar <string>("Select ItemTypeName from ItemTypes where ItemTypeId=@0", Ite);
     ViewBag.ite          = Ite;
     ViewBag.lid          = LocationId;
     ViewBag.LocationName = db.ExecuteScalar <string>("Select locationName from Location where LocationId=@0", LocationId);
     ViewBag.EDate        = String.Format("{0:dd-MMM-yyyy}", EDate ?? DateTime.Today);
     return(View("Receipt", base.BaseIndex <InvReceiptVw>(page, "InventoryTransactionID, TDate,QtyAdded, ItemName, RecvdByUserId,ChkByUserId, au.userName as RecvdBy,auc.UserName as ChkBy, UnitName  ",
                                                          "Items i, Aspnetusers au, Units u, InventoryTransaction it left outer join Aspnetusers auc  on it.ChkByUserId = auc.id  where it.itemId=i.itemId and it.RecvdByUserId = au.id and it.UnitId=u.UnitId " +
                                                          "and itemTypeId= " + (int)Ite + " and COALESCE(QtyAdded,0)>0 and ItemName like '%" + PropName + "%'" + ((ViewBag.EDate != null) ? " and TDate='" + (string)ViewBag.EDate + "'" : ""))));
 }
 public RibbonRemovalData(ItemTypesEnum PobjType, string PstrTabName, string PstrGroupName)
 {
     ItemType  = PobjType;
     GroupName = PstrGroupName;
     if (PstrTabName.Contains("\\"))
     {
         string[] LobjParts = PstrTabName.Split('\\');
         TabSet  = LobjParts[0];
         TabName = LobjParts[1];
     }
     else
     {
         TabName = PstrTabName;
     }
 }
Example #5
0
        public ActionResult ManagePortion([Bind(Include = "FoodStockId, InventoryTransactionId,TDate, ItemId, Qty, Size,UnitId, LocationId")] FoodStock fs, ItemTypesEnum ItemTypeId, int lid)
        {
            using (var transaction = db.GetTransaction())
            {
                try
                {
                    //fetch the conversion
                    var Existstk = db.SingleOrDefault <FoodStock>("select * from FoodStock where ItemId = " + fs.ItemId + " and locationId=" + lid + " and InventoryTransactionId=" + fs.InventoryTransactionId + " and TDate='" + String.Format("{0:yyyy-MM-dd}", fs.TDate) + "' ");
                    var conv     = db.FirstOrDefault <UnitConversion>("Select * from UnitConversion Where AUnitOfId = @0 and OfUnitId=@1 union select 10000,1,1,1", fs.UnitId, Existstk.UnitId); //default to 1

                    //if in edit mode add the old record qty back
                    if (fs.FoodStockId > 0)
                    {
                        var OldVal = db.ExecuteScalar <decimal>("select Qty*Size as val from FoodStock where FoodStockId=@0", fs.FoodStockId);
                        Existstk.Qty += (OldVal * conv.IsJust);
                    }

                    Existstk.Qty = Existstk.Qty - ((fs.Qty * fs.Size) * conv.IsJust);
                    db.Update(Existstk);

                    BaseSave <FoodStock>(fs, fs.FoodStockId > 0);

                    transaction.Complete();
                    return(RedirectToAction("Portion", new { id = fs.InventoryTransactionId, LocationId = lid, Ite = ItemTypeId }));
                }
                catch (Exception ex)
                {
                    db.AbortTransaction();
                    throw ex;
                }
            }
        }