Example #1
0
        public async Task <ActionResult> Reservation(ReservationView reserv)
        {
            // var appId = db.Apartments.FirstOrDefault(t => t.ApTypeId == reserv.TypeId).ApartmentId;
            var appartment = db.Apartments.Include(r => r.Type).FirstOrDefault(r => r.ApTypeId == reserv.TypeId);
            //   var price = db.ApTypes.FirstOrDefault(w => w.TypeId == reserv.TypeId).Price;
            var reservation = new Reservation()
            {
                StartDate        = reserv.StartDate,
                GuestCount       = reserv.GuestCount,
                Name             = reserv.Name,
                EndDate          = reserv.EndDate,
                ApartmentId      = appartment.ApartmentId,
                ChildrenCount    = reserv.ChildrenCount,
                Note             = reserv.Note,
                PhoneNumber      = reserv.PhoneNumber,
                Status           = ReservationStatus.ReservedByUser,
                ReservationPriсe = PriceHelper.GetPrice(appartment.Type, reserv.GuestCount),
                Email            = reserv.Email
            };

            db.Reservations.Add(reservation);
            await db.SaveChangesAsync();

            reservation.Apartment =
                db.Apartments.Include(r => r.Type).FirstOrDefault(r => r.ApTypeId == reserv.TypeId);
            emailHelper.SendEmail(reservation, Server);


            return(RedirectToAction("Index"));
        }
        public List <DatColStockModel> MapToDatCol(Int32 vendorId, List <Model.WehkampStockMutation> mutations)
        {
            using (var pDb = new PetaPoco.Database(Environments.Current.Connection, "System.Data.SqlClient"))
            {
                int connectorID = pDb.FirstOrDefault <int>(@"select connectorid from contentproduct where vendorid = @0 and isassortment = 1", vendorId);

                int    shopNumber           = ConnectorHelper.GetStoreNumber(connectorID);
                int    differenteShopNumber = VendorHelper.GetDifferenceShopNumber(vendorId);
                string employeeNumber       = VendorHelper.GetEmployeeNumber(vendorId);
                var    salesSlipNumber      = ReceiptHelper.GetSlipNumber(vendorId);

                int _receiptIndex       = GenericSlipNumberHelper.GetSlipNumberForTransfer(vendorId, ReceiptHelper.STOCK_SALESSLIP_RECEIPT_NUMBER_SETTING_KEY);
                int _receiptIndexSurplu = GenericSlipNumberHelper.GetSlipNumberForTransfer(vendorId, ReceiptHelper.STOCK_SALESSLIP_RECEIPT_NUMBER_SETTING_KEY_SURPLUS);
                mutations.ForEach(mutation =>
                {
                    _index += 200;

                    var line = new DatColStockModel
                    {
                        StoreNumber                    = (mutation.MutationQuantity > 0 ? differenteShopNumber : shopNumber).ToString("D3") + " 01",
                        EmployeeNumber                 = employeeNumber,
                        ReceiptNumber                  = salesSlipNumber,
                        TransactionType                = "20",
                        DateNotified                   = mutation.MutationDate.ToString("yyyyMMddHHmm"),
                        RecordType                     = "01",
                        SubType                        = "00",
                        NumberOfSkus                   = Math.Abs(mutation.MutationQuantity),
                        MancoOrSurplus                 = mutation.MutationQuantity > 0 ? shopNumber : differenteShopNumber,
                        FixedField1                    = "000000000+",
                        RecordSequence                 = _index,
                        FixedField2                    = "000",
                        FixedField3                    = "000000000+",
                        FixedField4                    = "000",
                        FixedField5                    = "000000000+",
                        FixedField6                    = "000",
                        OriginalSellingPrice           = (int)Math.Round(PriceHelper.GetPrice(mutation.ProductID, vendorId) * 100),
                        FixedField7                    = "00",
                        ArticleNumberColorCodeSizeCode = ProductHelper.GetPFAItemNumber(mutation.Articlenumber, mutation.Colorcode, mutation.ProductID),
                        Barcode                        = BarcodeHelper.GetBarcode(mutation.ProductID),
                        Receipt                        = string.Format("{0}{1}{2}", 0, mutation.MutationQuantity > 0 ? differenteShopNumber.ToString("D3") : shopNumber.ToString(), _receiptIndex.ToString().PadLeft(4, '0')),
                        TaxCode                        = "1",
                        EmployeeNumber2                = employeeNumber,
                        ScannedWithBarcodeReader       = 0
                    };

                    _list.Add(line);
                });
                ReceiptHelper.IncrementSalesSlipNumber(ref salesSlipNumber, vendorId, ReceiptHelper.STOCK_SALESSLIP_NUMBER_SETTINGKEY);

                return(_list);
            }
        }
Example #3
0
        public async Task <ActionResult> Create([Bind(Include = "ReservationId,ApartmentId,StartDate,EndDate,Name,Suname,Email,PhoneNumber")] Reservation reservation)
        {
            reservation.Status           = ReservationStatus.ReservedByUser;
            reservation.ReservationPriсe = PriceHelper.GetPrice(db.Apartments.Include(e => e.Type).First(r => r.ApartmentId == reservation.ApartmentId).Type, reservation.GuestCount);
            if (ModelState.IsValid)
            {
                db.Reservations.Add(reservation);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.ApartmentId = new SelectList(db.Apartments, "ApartmentId", "Name", reservation.ApartmentId);
            return(View(reservation));
        }
        private ReturnOrderDatcolModel GetDetailLevelForStore(int storeNumber, string employeeNumber, int salesSlipNumber, int transferSalesSlipNumber, DateTime messageTime, int ledgerQuantity, int differenceNumber, int recordSequence, int productID, int vendorId)
        {
            var line = new ReturnOrderDatcolModel()
            {
                StoreNumber         = string.Format("{0} {1}", differenceNumber.ToString("D3"), "01"),
                EmployeeNumber      = employeeNumber,
                ReceiptNumber       = salesSlipNumber,
                TransactionType     = "20", //
                DateNotified        = messageTime.ToString("yyyyMMddhhmm"),
                RecordType          = "01",
                SubType             = "00",
                NumberOfDifferences = ledgerQuantity,
                Price               = (int)Math.Round(PriceHelper.GetPrice(productID, vendorId) * 100),
                ReceivingStore      = storeNumber,
                RecordSequence      = recordSequence,
                TransferNumber      = string.Format("{0}{1}", differenceNumber.ToString("D3"), transferSalesSlipNumber.ToString("D4")),
                SkuVendorItemNumber = ProductHelper.GetPFAItemNumber(null, null, productID),
                EmployeeNumber2     = employeeNumber,
                Barcode             = BarcodeHelper.GetBarcode(productID).PadLeft(20, '0'),
            };

            return(line);
        }
        private void 新增ToolStripButton_Click(object sender, EventArgs e)
        {//新增水电气费
            string v_费用类型 = "物业费用";
            string v_小区名称 = this.小区名称ToolStripComboBox.Text.Trim();
            string v_楼栋名称 = this.楼栋名称ToolStripComboBox.Text.Trim();
            string v_计费年份 = this.计费年份ToolStripComboBox.Text.Trim();
            string v_计费月份 = this.计费月份ToolStripComboBox.Text.Trim();

            if (string.IsNullOrEmpty(v_计费年份) || string.IsNullOrEmpty(v_计费月份) || string.IsNullOrEmpty(v_小区名称) || string.IsNullOrEmpty(v_楼栋名称))
            {
                new MsgBoxForm("提示", "没有选择正确的计费年份,计费月份,小区名称,楼栋名称等信息!").ShowDialog();
                return;
            }
            double d_计费单价 = PriceHelper.GetPrice("电费");

            if (d_计费单价 <= 0)
            {
                new MsgBoxForm("提示", string.Format("{0}计费单价还未设定,请先在小区信息设置界面进行设置!", "电费")).ShowDialog();
                return;
            }
            if (new MsgBoxForm("提示", string.Format("现在将新增{0}-{1}{2}年{3}月的{4}数据,是否继续?", v_小区名称, v_楼栋名称, v_计费年份, v_计费月份, v_费用类型), true).ShowDialog() != DialogResult.OK)
            {
                return;
            }
            string    query = string.Format("select 自动编号 from 水电气费 where 计费年份={0} and 计费月份={1} and 费用类型='{2}' and 楼栋名称='{3}'", v_计费年份, v_计费月份, v_费用类型, v_楼栋名称);
            DataTable dt    = DataHelper.GetDataTable(query);

            if (dt.Rows.Count == 0)
            {//插入新月份费用的业主基本信息
                string insertQuery = "INSERT INTO 水电气费 (楼栋名称,业主编号,业主姓名,表编号) SELECT 业主信息.楼栋名称,业主信息.业主编号,业主信息.业主姓名,电表信息.电表编号 from 业主信息 right join 电表信息 on 业主信息.业主编号=电表信息.业主编号 WHERE (业主信息.业主编号 NOT IN (SELECT 业主编号 FROM 迁出信息)) AND (业主信息.楼栋名称='" + v_楼栋名称 + "')";
                DataHelper.UpdateOrDeleteRecord(insertQuery);
                string updateQuery = "UPDATE 水电气费 SET 登记标志='正在登记',费用类型='" + v_费用类型 + "',计费年份=" + v_计费年份 + ",计费月份=" + v_计费月份 + ",计费单价=" + d_计费单价 + " WHERE 登记标志 IS NULL AND (楼栋名称='" + v_楼栋名称 + "')";
                DataHelper.UpdateOrDeleteRecord(updateQuery);
                int MyLastMonth = Convert.ToInt16(v_计费月份) - 1;
                int MyLastYear  = Convert.ToInt16(v_计费年份);
                if (MyLastMonth == 0)
                {
                    MyLastMonth = 12;
                    MyLastYear  = Convert.ToInt16(v_计费年份) - 1;
                }
                //将上月止数作为新月份底数
                string    lastMonthQuery   = "Select 楼栋名称,业主编号,业主姓名,计费年份,计费月份,费用类型,表编号,上月数,本月数 FROM 水电气费 WHERE 计费年份=" + MyLastYear + " AND 计费月份=" + MyLastMonth + " AND 费用类型='" + v_费用类型 + "' AND 楼栋名称='" + v_楼栋名称 + "' AND 登记标志='完成登记'";
                DataTable myLastMonthTable = DataHelper.GetDataTable(lastMonthQuery);
                if (myLastMonthTable.Rows.Count > 0)
                {
                    foreach (DataRow dRow in myLastMonthTable.Rows)
                    {
                        string My楼栋名称 = Helper.Obj2String(dRow[0]);
                        string My业主编号 = Helper.Obj2String(dRow[1]);
                        string My计费年份 = Helper.Obj2String(dRow[3]);
                        string My计费月份 = Helper.Obj2String(dRow[4]);
                        string My费用类型 = Helper.Obj2String(dRow[5]);
                        string My表编号  = Helper.Obj2String(dRow[6]);
                        double My上月数  = Helper.Obj2Double(dRow[7]);
                        double My本月数  = Helper.Obj2Double(dRow[8]);
                        updateQuery = "UPDATE 水电气费 SET 上月数=" + My本月数 + " WHERE 计费年份=" + v_计费年份 + " AND 计费月份=" + v_计费月份 + " AND 费用类型='" + v_费用类型 + "' AND 楼栋名称='" + v_楼栋名称 + "' AND 业主编号='" + My业主编号 + "' AND 表编号='" + My表编号 + "'";
                        DataHelper.UpdateOrDeleteRecord(updateQuery);
                    }
                }
                DataHelper.CommitUpdate();
                SynGasRegisterInfo(v_计费年份, v_计费月份, v_楼栋名称, "正在登记");
            }
            else
            {
                new MsgBoxForm("提示", "当月" + v_费用类型 + "已登记!").ShowDialog();
                return;
            }
        }
Example #6
0
        public JsonResult GetAppPrice(int apTypeId, int gusetCount)
        {
            var type = db.ApTypes.Find(apTypeId);

            return(Json(PriceHelper.GetPrice(type, gusetCount), JsonRequestBehavior.AllowGet));
        }