public JsonResult AddLinetoBill(int HeaderId, double Amount, int BillID, string HeaderText)
        {
            bool status = false;
            int  lineid = 0;

            if (ModelState.IsValid)
            {
                //Order order = new Order { OrderNo = O.OrderNo, OrderDate = O.OrderDate, Description = O.Description };

                //
                // i.TotalAmount =
                Billdetail billdetail = new Billdetail();
                billdetail.BillID   = BillID;
                billdetail.HeaderId = HeaderId;
                billdetail.Amount   = Amount;
                db.Billdetail.Add(billdetail);
                db.SaveChanges();
                lineid = billdetail.lineId;

                status = true;
            }
            else
            {
                status = false;
            }
            return(new JsonResult {
                Data = new { status = status, lineid = lineid, amount = Amount }
            });
        }
        public JsonResult SaveOrder(BillVm O)
        {
            bool status = false;

            if (ModelState.IsValid)
            {
                //Order order = new Order { OrderNo = O.OrderNo, OrderDate = O.OrderDate, Description = O.Description };
                BillRegister billregister = new BillRegister {
                    BillDate = O.billdate, Remarks = O.remarks, memberId = O.memberid, paid = "N"
                };
                db.BillRegisters.Add(billregister);
                db.SaveChanges();
                foreach (var i in O.BillDetail)
                {
                    //
                    // i.TotalAmount =
                    Billdetail billdetail = new Billdetail();
                    billdetail.BillID   = billregister.BillID;
                    billdetail.HeaderId = i.headerid;
                    billdetail.Amount   = i.amount;
                    db.Billdetail.Add(billdetail);
                    db.SaveChanges();
                }

                status = true;
            }
            else
            {
                status = false;
            }
            return(new JsonResult {
                Data = new { status = status }
            });
        }
Beispiel #3
0
        /// <summary>
        /// 设置billdetail赋值
        /// </summary>
        /// <param name="billheadid">billheadid</param>
        /// <param name="ordernum">ordernum</param>
        /// <param name="test">ordergrouptest实体</param>
        /// <returns></returns>
        public Billdetail SetBillDetail(double?billheadid, string ordernum, Ordergrouptest test, string remark)
        {
            UserInfo   userInfo = GetUserInfo();
            Billdetail detail   = new Billdetail();

            detail.Billheadid     = billheadid;
            detail.Ordernum       = ordernum;
            detail.Dicttestitemid = test.Dicttestitemid;
            detail.Standardprice  = test.Standardprice;
            detail.Groupprice     = test.Groupprice;
            detail.Contractprice  = test.Contractprice;
            detail.Finalprice     = test.Finalprice;
            int stat = (int)ParamStatus.BilldetailStatus.Normal;

            detail.Status        = stat.ToString();
            detail.Remark        = remark;
            detail.Selfremark    = "";
            detail.Createdate    = System.DateTime.Now;
            detail.Enterby       = userInfo.userId;
            detail.Enterdate     = System.DateTime.Now;
            detail.Dictproductid = test.Dictproductid;
            detail.Productname   = test.Productname;
            detail.Testname      = test.Testname;

            return(detail);
        }
        public async Task <ActionResult> DeleteLine(int id)
        {
            Billdetail billdetail = await db.Billdetail.FindAsync(id);

            db.Billdetail.Remove(billdetail);
            await db.SaveChangesAsync();

            return(RedirectToAction("Edit/" + billdetail.BillID));
        }
        public ActionResult Create(FormCollection form)
        {
            int temp = 0;

            // Thread.Sleep(1000);
            if (ModelState.IsValid)
            {
                List <MemberCompanyInfo> memberinfo = db.MemberCompanyInfo.Where(s => s.status != "P").ToList();
                List <MonthlyBillSetUP>  billsetup  = db.MonthlyBillSetUPs.ToList();

                // List<MemberCompanyInfo> memberinfo = db.MemberCompanyInfo.SqlQuery("Select * from MemberCompanyInfo Where status='P'").ToList();
                // List<MonthlyBillSetUP> billsetup = db.MonthlyBillSetUPs.ToList();
                foreach (var member in memberinfo)
                {
                    BillRegister billregister = new BillRegister();
                    billregister.BillDate = Convert.ToDateTime(form["BillDate"]);
                    billregister.memberId = member.memberId;
                    billregister.paid     = "N";
                    billregister.Remarks  = form["Remarks"].ToString();
                    db.BillRegisters.Add(billregister);
                    db.SaveChanges();
                    Billdetail billdetail = new Billdetail();
                    foreach (var bs in billsetup)
                    {
                        billdetail.BillID   = billregister.BillID;
                        billdetail.Amount   = bs.Amount;
                        billdetail.HeaderId = bs.HeaderId;
                        db.Billdetail.Add(billdetail);
                        db.SaveChanges();
                    }

                    temp = 1;
                }
            }
            //    var result = new {


            //        res="Data Saved"

            //};
            //var result1 = new
            //{


            //    res = "Error"

            //};
            //if (temp == 1)
            //{
            //    return Json(result);
            //}
            //else
            //{
            //    return Json(result1);
            //}
            return(View());
        }
Beispiel #6
0
        /// <summary>
        /// 事务处理预出账查询
        /// </summary>
        /// <returns></returns>
        public bool BillPrepareOutSearch(Hashtable ht)
        {
            UserInfo userInfo = GetUserInfo();
            OrdergrouptestService ordergrouptestService = new OrdergrouptestService();
            CommonFuncLibService  comm = new CommonFuncLibService();

            try
            {
                //获取grouptest收费信息,并重新算价
                IList <Ordergrouptest> grouptestList         = ordergrouptestService.GetOrdergrouptestPrice(ht);
                IList <Ordergrouptest> grouptestNewPriceList = comm.OrdergrouptestNewPrice(grouptestList, ht);

                //删除billdetail表老记录
                SortedList SQLlist = new SortedList(new MySort());
                SQLlist.Add(new Hashtable()
                {
                    { "DELETE", "Bill.DeleteBilldetailBySearch" }
                }, ht);

                //插入重组后的集合grouptest到数据到表 BILLDETAIL中
                foreach (Ordergrouptest test in grouptestNewPriceList)
                {
                    Billdetail detail = new Billdetail();
                    detail = SetBillDetail(null, test.Ordernum, test, "");

                    detail.Billdetailid = this.getSeqID("SEQ_BILLDETAIL");
                    SQLlist.Add(new Hashtable()
                    {
                        { "INSERT", "Bill.InsertBilldetail" }
                    }, detail);
                }
                return(this.ExecuteSqlTran(SQLlist));
            }
            catch (Exception ex)
            {
                return(false);

                throw new Exception(ex.Message);
            }
        }
        public void Create(Billdetail_Model model)
        {
            var data = Connect_Enttity.Billdetails.FirstOrDefault(x => x.id == model.id);

            if (data == null)
            {
                var entity = new Billdetail();
                entity.bilid        = (int)(model.bilid);
                entity.proid        = (int)(model.proid);
                entity.sizeid       = (int)(model.sizeid);
                entity.colorid      = (int)(model.colorid);
                entity.quantity     = (int)(model.quantity);
                entity.bilprice     = model.bilprice;
                entity.bilpricevnd  = model.bilpricevnd;
                entity.bilmoney     = model.bilmoney;
                entity.billlocation = (int)(model.billlocation);
                entity.Date         = Convert.ToDateTime(model.Date);
                entity.status       = (int)(model.status);

                Connect_Enttity.Billdetails.Add(entity);
                Connect_Enttity.SaveChanges();
                Dispose();
            }
        }
Beispiel #8
0
        /// <summary>
        /// 事物处理个人收费"调价"
        /// </summary>
        /// <returns></returns>
        public bool BillIndividualUpdatePrice(IList <Ordergrouptest> oldList, IList <Ordergrouptest> newList, double?customerid, string ordernum, double dictlabid, string remark)
        {
            UserInfo userInfo = GetUserInfo();

            try
            {
                //获得财务清单核对人
                LoginService loginService = new LoginService();

                List <Dictcustomer> customerList = loginService.GetDictcustomer();
                int customercode             = (int)ParamStatus.PersonalCustomerID.SingleCustomerCode;
                List <Dictcustomer> customer = (from a in customerList where a.Customercode == customercode.ToString() select a).ToList();

                SortedList SQLlist = new SortedList(new MySort());
                double?    d       = 0;
                //生成账单头表数据
                Billhead head = new Billhead();
                head.Dictlabid = dictlabid;
                int sta = (int)ParamStatus.BillheadStatus.PrepareOut;
                head.Status             = sta.ToString();
                head.Remark             = remark;
                head.Createdate         = System.DateTime.Now;
                head.Billby             = userInfo.userId;
                head.Duedate            = System.DateTime.Now;
                head.Receipno           = "";
                head.Dictcustomerid     = customerid;
                head.Dictcheckbillid    = customer.Count > 0 ? customer[0].Dictcheckbillid : null;
                head.Customertype       = "0";
                head.Billtype           = "个检账单";
                head.Totalcontractprice = newList.Sum(c => c.Contractprice);
                head.Totalfinalprice    = newList.Sum(c => c.Finalprice);
                head.Totalstandardprice = newList.Sum(c => c.Standardprice);
                head.Totalgrouprprice   = newList.Sum(c => c.Groupprice);
                head.Billheadid         = this.getSeqID("SEQ_BILLHEAD");
                head.Invoiceno          = head.Billheadid.Value.ToString();
                head.Begindate          = DateTime.Now;
                head.Enddate            = DateTime.Now;
                SQLlist.Add(new Hashtable()
                {
                    { "INSERT", "Bill.InsertBillhead" }
                }, head);

                //循环生成账单明细信息
                foreach (Ordergrouptest test in newList)
                {
                    Billdetail detail = new Billdetail();
                    detail = SetBillDetail(head.Billheadid, ordernum, test, remark);

                    detail.Billdetailid = this.getSeqID("SEQ_BILLDETAIL");
                    SQLlist.Add(new Hashtable()
                    {
                        { "INSERT", "Bill.InsertBilldetail" }
                    }, detail);


                    //更新ordergrouptest表实收价格
                    Hashtable htgrouptest = new Hashtable();
                    htgrouptest["flag"]           = "nosendout";
                    htgrouptest["ordernum"]       = ordernum;
                    htgrouptest["dicttestitemid"] = test.Dicttestitemid;
                    htgrouptest["finalprice"]     = test.Finalprice;
                    SQLlist.Add(new Hashtable()
                    {
                        { "UPDATE", "Order.UpdateOrdergrouptestFinalPrice" }
                    }, htgrouptest);
                }

                bool result = this.ExecuteSqlTran(SQLlist);
                if (result)
                {
                    //修改价钱日志记录
                    for (int i = 0; i < oldList.Count; i++)
                    {
                        if (!oldList[i].Finalprice.Equals(newList[i].Finalprice))
                        {
                            UpdateBilldetailFinalpriceLog(oldList[i], newList[i], ordernum);
                        }
                    }

                    //已付款日志记录
                    AddOperationLog(ordernum, "", "财务管理", "已收费", "节点信息", "");
                }
                return(result);
            }
            catch (Exception ex)
            {
                return(false);

                throw new Exception(ex.Message);
            }
        }