Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            switch (RequestActionString)
            {
            case "batchdelete":
                DoBatchDelete();
                break;

            case "FinishPay":
                IList <string>  entStrList = RequestData.GetList <string>("data");
                IList <PayBill> ents       = entStrList.Select(tent => JsonHelper.GetObject <PayBill>(tent) as PayBill).ToList();
                foreach (PayBill pbEnt in ents)
                {
                    if (!string.IsNullOrEmpty(pbEnt.Id))
                    {
                        PayBill tempEnt = PayBill.Find(pbEnt.Id);    //直接更新会丢失字段信息
                        tempEnt.State = "已付款";
                        tempEnt.DoUpdate();
                        UpdatePayState(tempEnt.Id);
                    }
                }
                break;

            default:
                DoSelect();
                break;
            }
        }
Esempio n. 2
0
        string type = String.Empty; // 对象类型

        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");
            IList <string> entStrList = RequestData.GetList <string>("data");

            switch (RequestActionString)
            {
            case "WorkFlowEnd":
                PayBill ent = PayBill.Find(id);
                ent.WorkFlowState = RequestData.Get <string>("state");
                ent.ExamineResult = RequestData.Get <string>("ApprovalState");
                ent.DoUpdate();
                break;

            default:
                DoSelect();
                break;
            }
            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    string tempsql = @"select A.* ,B.MoneyType,B.Symbo from SHHG_AimExamine..PayBill as A 
                    left join SHHG_AimExamine..Supplier as B on A.SupplierId=B.Id where A.Id='{0}'";
                    tempsql = string.Format(tempsql, id);
                    IList <EasyDictionary> dics = DataHelper.QueryDictList(tempsql);
                    if (dics.Count > 0)
                    {
                        SetFormData(dics[0]);
                    }
                }
            }
        }
Esempio n. 3
0
        private void DoBatchDelete()
        {
            IList <object> idList = RequestData.GetList <object>("IdList");

            if (idList != null && idList.Count > 0)
            {
                PayBill.DoBatchDelete(idList.ToArray());
                foreach (object obj in idList)
                {
                    PayBillDetail.DeleteAll("PayBillId='" + obj + "'");
                }
            }
        }
Esempio n. 4
0
        public Task <IEnumerable <ItemLine> > PayBill(PayBill payBill)
        {
            var  items  = _itemLines.Values.Where(x => x.ClaimerId == payBill.UserId);
            Guid?billId = null;

            foreach (var item in items)
            {
                billId       = item.BillId;
                item.Tip     = payBill.TipAmount;
                item.PayerId = payBill.UserId;
                item.IsPaid  = true;
            }

            return(Task.FromResult(_itemLines.Values.Where(x => x.BillId == billId)));
        }
Esempio n. 5
0
        public ActionResult Employee(EmployeeTableRowModels model)
        {
            using (IHoneyMustardDataSource ds = Factories.DataSourceFactory.GetDataSource())
            {
                if (ModelState.IsValid)
                {
                    PayBill payment = new PayBill();

                    payment.AmountPaid      = model.AmountPaid;
                    payment.Date            = model.Date;
                    payment.PaymentMethodID = int.Parse(model.PaymentMethod);
                    payment.ContactID       = model.ContactID;
                    ds.PayBill.Add(payment);
                    ds.SaveChanges();
                }
                return(RedirectToAction("Employee"));
            }
        }
Esempio n. 6
0
        public BaseResponse <PayBill> SavePayBill(PayBill request)
        {
            if (request.Id == 0)
            {
                request.PayBillNo = base.GenerateCode(SecurityHelper.CurrentPrincipal.OrgId, EnumCodeKey.PayBillNo);
            }

            #region 当缴费已完成时,更新账单状态
            if (request.BillStatus == "003")
            {
                var billInfo = unitOfWork.GetRepository <LTC_BILL>().dbSet.Where(m => m.ID == request.BillId).FirstOrDefault();
                if (billInfo != null)
                {
                    billInfo.BILLSTATE = GetEnumDescription(EnumBillState.Close).ToString();
                    unitOfWork.GetRepository <LTC_BILL>().Update(billInfo);
                    unitOfWork.Save();
                }
            }
            #endregion
            return(base.Save <LTC_PAYBILL, PayBill>(request, (q) => q.ID == request.Id));
        }
Esempio n. 7
0
        string type = String.Empty; // 对象类型
        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");
            PayBill ent = null;

            switch (RequestActionString)
            {
            case "PayBillPay":
                ent = PayBill.Find(id);
                ActualPayDetail apdEnt = new ActualPayDetail();
                if (!string.IsNullOrEmpty(RequestData.Get <string>("PayAmount")))
                {
                    ent.ActuallyPayAmount  = ent.ActuallyPayAmount + RequestData.Get <decimal>("PayAmount");
                    apdEnt.ActualPayAmount = RequestData.Get <decimal>("PayAmount");
                }
                apdEnt.PayBillId  = ent.Id;
                apdEnt.CreateId   = UserInfo.UserID;
                apdEnt.CreateName = UserInfo.Name;
                apdEnt.CreateTime = System.DateTime.Now;
                apdEnt.Remark     = RequestData.Get <string>("Remark");
                ent.DoUpdate();
                apdEnt.DoCreate();
                IList <PayBillDetail> pbdEnts = PayBillDetail.FindAll("from PayBillDetail where PayBillId='" + ent.Id + "'");
                Supplier supplierEnt          = Supplier.Find(ent.SupplierId);
                if (supplierEnt.Symbo == "¥")    //如果付款单的币种为本币
                {
                    if (ent.PAmount == ent.ActuallyPayAmount + (ent.DiscountAmount.HasValue ? ent.DiscountAmount.Value : 0))
                    {
                        ent.State = "已付款"; ent.DoUpdate();
                    }
                }
                //付款成功后 如果付款单为已付款状态 遍历采购单详细
                if (ent.State == "已付款")
                {
                    string tempsql = @"select * from SHHG_AimExamine..PayBillDetail where PayBillId='{0}'";
                    tempsql = string.Format(tempsql, ent.Id);
                    IList <EasyDictionary> dicPayDetail = DataHelper.QueryDictList(tempsql);
                    PurchaseOrderDetail    podEnt       = null;
                    ArrayList idarray = new ArrayList();    //搜集涉及的采购单ID
                    string    poId    = string.Empty;
                    string    podId   = string.Empty;
                    int       nopay   = 0;
                    foreach (EasyDictionary ea in dicPayDetail)
                    {
                        podId  = ea.Get <string>("PurchaseOrderDetailId");
                        podEnt = PurchaseOrderDetail.TryFind(podId);
                        //取得采购详细的实际未付款数目
                        nopay = Convert.ToInt32(DataHelper.QueryValue("select SHHG_AimExamine.dbo.fun_ActuallNoPayQuan('" + podId + "')"));
                        if (nopay == 0)
                        {
                            podEnt.PayState = "已付款";
                            podEnt.DoUpdate();
                        }
                        if (podEnt.PurchaseOrderId != poId)
                        {
                            poId = podEnt.PurchaseOrderId;
                            idarray.Add(poId);
                        }
                    }
                    //付款单涉及的采购详细表状态遍历完后。再遍历付款单涉及的采购单
                    PurchaseOrder poEnt = null;
                    foreach (object ob in idarray)
                    {
                        IList <PurchaseOrderDetail> podEnts = PurchaseOrderDetail.FindAll("from PurchaseOrderDetail where PayState='未付款' and PurchaseOrderId='" + ob.ToString() + "'");
                        if (podEnts.Count == 0)
                        {
                            poEnt          = PurchaseOrder.TryFind(ob.ToString());
                            poEnt.PayState = "已付款";
                            if (poEnt.InvoiceState == "已关联" && poEnt.InWarehouseState == "已入库")
                            {
                                poEnt.OrderState = "已结束";
                            }
                            poEnt.DoUpdate();
                        }
                    }
                }
                break;

            default:
                DoSelect();
                break;
            }
            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    string tempsql = @"select A.* ,B.MoneyType,B.Symbo from SHHG_AimExamine..PayBill as A 
                    left join SHHG_AimExamine..Supplier as B on A.SupplierId=B.Id where A.Id='{0}'";
                    tempsql = string.Format(tempsql, id);
                    IList <EasyDictionary> dics = DataHelper.QueryDictList(tempsql);
                    if (dics.Count > 0)
                    {
                        this.SetFormData(dics[0]);
                    }
                }
            }
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Aim.Portal.Web.WebPortalService.CheckLogon();
            }
            catch
            {
                Response.Write("<script> window.location.href = '/Login.aspx';</script>");
                Response.End();
            }
            string                action         = Request["action"];
            string                sql            = "";
            DataTable             dt             = null;
            PayBill               pbEnt          = null;
            IList <PayBillDetail> pbdEnts        = null;
            InWarehouseDetail     iwdEnt         = null;
            string                id             = Request["id"];
            string                inwarehouseids = Request["inwarehouseids"];

            if (!string.IsNullOrEmpty(id))
            {
                pbEnt = PayBill.Find(id);
            }
            switch (action)
            {
            case "loaddetail":
                if (!string.IsNullOrEmpty(id))
                {
                    sql = @"select a.Id,a.PurchaseOrderDetailId, a.ProductId,a.ProductCode,a.PayQuantity,a.BuyPrice,a.Amount,a.ProductName,
                        c.PurchaseOrderNo,(d.IQuantity-isnull(d.FuKuanDanQuan,0)+a.PayQuantity) as MaxQuan,a.InWarehouseDetailId  
                        from SHHG_AimExamine..PayBillDetail a 
                        left join SHHG_AimExamine..InWarehouseDetail d on d.Id=a.InWarehouseDetailId               
                        left join SHHG_AimExamine..PurchaseOrderDetail b on a.PurchaseOrderDetailId=b.Id                      
                        left join SHHG_AimExamine..PurchaseOrder c on c.Id=b.PurchaseOrderId  
                        where a.PayBillId='" + id + "' order by a.ProductCode asc";
                }
                if (!string.IsNullOrEmpty(inwarehouseids))
                {
                    sql = @"select a.Id InWarehouseDetailId, a.ProductId,a.PurchaseOrderDetailId, a.ProductCode,b.Name as ProductName, b.BuyPrice,c.PurchaseOrderNo,                                        
                        (a.IQuantity-isnull(a.FuKuanDanQuan,0)) as PayQuantity, (a.IQuantity-isnull(a.FuKuanDanQuan,0)) as MaxQuan,(a.IQuantity-isnull(a.FuKuanDanQuan,0))*(b.BuyPrice) as Amount
                        from SHHG_AimExamine..InWarehouseDetail a 
                        left join SHHG_AimExamine..PurchaseOrderDetail b on a.PurchaseOrderDetailId=b.Id 
                        left join SHHG_AimExamine..PurchaseOrder c on c.Id=b.PurchaseOrderId
                        where (a.IQuantity-isnull(a.FuKuanDanQuan,0))>0 and ('" + inwarehouseids + "' like '%'+a.InWarehouseId+'%') order by a.ProductCode asc";
                }
                dt = DataHelper.QueryDataTable(sql);
                Response.Write("{rows:" + JsonHelper.GetJsonStringFromDataTable(dt) + "}");
                Response.End();
                break;

            case "loadform":
                if (!string.IsNullOrEmpty(inwarehouseids))
                {
                    pbEnt           = new PayBill();
                    pbEnt.PayBillNo = DataHelper.QueryValue("select SHHG_AimExamine.dbo.fun_getPayBillNo()").ToString();
                    string[]    idarray = inwarehouseids.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    InWarehouse iwEnt   = InWarehouse.Find(idarray[0]);
                    pbEnt.SupplierId   = iwEnt.SupplierId;
                    pbEnt.SupplierName = iwEnt.SupplierName;
                    Supplier sEnt = Supplier.Find(iwEnt.SupplierId);
                    pbEnt.Symbo = sEnt.Symbo;
                    Response.Write("{success:true,data:" + JsonHelper.GetJsonString(pbEnt) + "}");
                }
                if (!string.IsNullOrEmpty(id))
                {
                    Response.Write("{success:true,data:" + JsonHelper.GetJsonString(pbEnt) + "}");
                }
                Response.End();
                break;

            case "create":
                pbEnt            = JsonHelper.GetObject <PayBill>(Request["formdata"]);
                pbEnt.CreateId   = Aim.Portal.Web.WebPortalService.CurrentUserInfo.UserID;
                pbEnt.CreateName = Aim.Portal.Web.WebPortalService.CurrentUserInfo.Name;
                pbEnt.CreateTime = DateTime.Now;
                pbEnt.State      = "未付款";
                pbEnt.DoCreate();
                pbdEnts = JsonHelper.GetObject <IList <PayBillDetail> >(Request["detaildata"]);
                foreach (PayBillDetail pbdEnt in pbdEnts)
                {
                    pbdEnt.PayBillId = pbEnt.Id;
                    pbdEnt.DoCreate();
                    //创建完付款单明细后更新入库单明细的生成付款单数量
                    sql    = "select sum(isnull(PayQuantity,0)) from SHHG_AimExamine..PayBillDetail where InWarehouseDetailId='" + pbdEnt.InWarehouseDetailId + "'";
                    iwdEnt = InWarehouseDetail.Find(pbdEnt.InWarehouseDetailId);
                    iwdEnt.FuKuanDanQuan = DataHelper.QueryValue <Int32>(sql);
                    iwdEnt.DoUpdate();
                }
                Response.Write("{success:true}");
                Response.End();
                break;

            case "update":
                PayBill        tempEnt = JsonHelper.GetObject <PayBill>(Request["formdata"]);
                EasyDictionary dic     = JsonHelper.GetObject <EasyDictionary>(Request["formdata"]);
                pbEnt = DataHelper.MergeData <PayBill>(pbEnt, tempEnt, dic.Keys);
                pbEnt.DoUpdate();
                sql = "delete SHHG_AimExamine..PayBillDetail where PayBillId='" + pbEnt.Id + "'";
                DataHelper.ExecSql(sql);
                pbdEnts = JsonHelper.GetObject <IList <PayBillDetail> >(Request["detaildata"]);
                foreach (PayBillDetail pbdEnt in pbdEnts)
                {
                    pbdEnt.PayBillId = pbEnt.Id;
                    pbdEnt.DoCreate();
                    //创建完付款单明细后更新入库单明细的生成付款单数量
                    sql    = "select sum(isnull(PayQuantity,0)) from SHHG_AimExamine..PayBillDetail where InWarehouseDetailId='" + pbdEnt.InWarehouseDetailId + "'";
                    iwdEnt = InWarehouseDetail.Find(pbdEnt.InWarehouseDetailId);
                    iwdEnt.FuKuanDanQuan = DataHelper.QueryValue <Int32>(sql);
                    iwdEnt.DoUpdate();
                }
                Response.Write("{success:true}");
                Response.End();
                break;
            }
        }
Esempio n. 9
0
        public IHttpActionResult Post(PayBill baseRequest)
        {
            var response = service.SavePayBill(baseRequest);

            return(Ok(response));
        }
Esempio n. 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Aim.Portal.Web.WebPortalService.CheckLogon();
            }
            catch
            {
                Response.Write("<script> window.location.href = '/Login.aspx';</script>");
                Response.End();
            }
            string action = Request["action"];

            string where = "";
            DataTable dt    = null;
            string    id    = Request["id"];
            PayBill   pbEnt = null;

            if (!string.IsNullOrEmpty(id))
            {
                pbEnt = PayBill.Find(id);
            }
            IList <PayBillDetail> pbdEnts = null;

            switch (action)
            {
            case "load":
                if (!string.IsNullOrEmpty(Request["PayBillNo"]))
                {
                    where += " and PayBillNo like '%" + Request["PayBillNo"].Trim() + "%'";
                }
                if (!string.IsNullOrEmpty(Request["SupplierName"]))
                {
                    where += " and SupplierName like '%" + Request["SupplierName"].Trim() + "%'";
                }
                if (!string.IsNullOrEmpty(Request["State"]))
                {
                    where += " and State = '" + Request["State"] + "'";
                }
                if (!string.IsNullOrEmpty(Request["ProductCode"]))
                {
                    where += " and Id in (select distinct PayBillId from SHHG_AimExamine..PayBillDetail where  ProductCode like '%" + Request["ProductCode"] + "%')";
                }
                sql = @"select * from SHHG_AimExamine..PayBill where 1=1 " + where;
                dt  = DataHelper.QueryDataTable(GetPageSql(sql));
                Response.Write("{total:" + totalProperty + ",rows:" + JsonHelper.GetJsonStringFromDataTable(dt) + "}");
                Response.End();
                break;

            case "loaddetail":
                sql = @"select a.*,c.PurchaseOrderNo from SHHG_AimExamine..PayBillDetail a 
                            left join SHHG_AimExamine..PurchaseOrderDetail b on a.PurchaseOrderDetailId=b.Id 
                            left join SHHG_AimExamine..PurchaseOrder c on b.PurchaseOrderId=c.Id 
                            where a.PayBillId='" + id + "' order by a.ProductCode asc";
                dt  = DataHelper.QueryDataTable(sql);
                Response.Write("{innerrows:" + JsonHelper.GetJsonStringFromDataTable(dt) + "}");
                Response.End();
                break;

            case "delete":
                pbEnt   = PayBill.Find(id);
                pbdEnts = PayBillDetail.FindAllByProperty("PayBillId", id);
                foreach (PayBillDetail tempEnt in pbdEnts)
                {
                    //删除完付款单明细后需要更新入库单明细的生成付款单的数量
                    if (!string.IsNullOrEmpty(tempEnt.InWarehouseDetailId))
                    {
                        InWarehouseDetail iwdEnt = InWarehouseDetail.Find(tempEnt.InWarehouseDetailId);
                        iwdEnt.FuKuanDanQuan = iwdEnt.FuKuanDanQuan - tempEnt.PayQuantity;
                        iwdEnt.DoUpdate();
                        tempEnt.DoDelete();
                    }
                }
                //如果已经审批过了,还需要删除workflowinstance    task记录
                IList <WorkflowInstance> wiEnts = WorkflowInstance.FindAllByProperty(WorkflowInstance.Prop_EFormInstanceID, pbEnt.Id);
                foreach (WorkflowInstance wiEnt in wiEnts)
                {
                    IList <Task> tEnts = Task.FindAllByProperty(Task.Prop_WorkflowInstanceID, wiEnt.ID);
                    foreach (Task tEnt in tEnts)
                    {
                        tEnt.DoDelete();
                    }
                }
                pbEnt.DoDelete();
                Response.Write("{success:true}");
                Response.End();
                break;

            case "examine":
                WorkflowTemplate ne         = WorkflowTemplate.FindAllByProperties(Aim.WorkFlow.WorkflowTemplate.Prop_Code, Request["flowkey"])[0];
                string           formUrl    = "/PurchaseManagement/PayBillView.aspx?id=" + id; //启动流程表单路径,后面加上参数传入
                Guid             instanceid = Aim.WorkFlow.WorkFlow.StartWorkFlow(id, formUrl, "付款单【" + pbEnt.PayBillNo + "】申请人【" + pbEnt.CreateName + "】", Request["flowkey"], WebPortalService.CurrentUserInfo.UserID, WebPortalService.CurrentUserInfo.Name);
                pbEnt.WorkFlowState = "flowing";
                pbEnt.ExamineResult = "已提交";
                pbEnt.DoUpdate();
                Response.Write("{success:true,instanceid:'" + instanceid + "'}");
                Response.End();
                break;

            case "autoexec":
                Task task = Task.FindAllByProperties(Task.Prop_WorkflowInstanceID, Request["instanceid"])[0];
                Aim.WorkFlow.WorkFlow.AutoExecute(task);
                Response.Write("{success:true}");
                Response.End();
                break;
            }
        }
        public void ExecuteApplication()
        {
            Order     order     = new Order();
            PayBill   payBill   = new PayBill();
            MenuActor menuActor = new MenuActor(order, payBill);
            var       menuItems = menuActor.GetConvertedData();


            int    userChoice;
            string confirm;

startMenu:
            MenuActor.DisplayMainMenu();
            do
            {
UserChoice:
                Console.Write("\nEnter your choice(1-5):");
                userChoice = int.Parse(Console.ReadLine());
                switch (userChoice)
                {
                case 1:
                    MenuActor.DisplayFoodMenu(menuItems);
                    do
                    {
RepeatOrder:
                        menuActor.GetOrderFromUser(menuItems);
                        Console.Write("Do you want to add another table order(Y/N): ");
                        confirm = Console.ReadLine();
                        while (!(confirm == "Y" || confirm == "y" || confirm == "N" || confirm == "n"))
                        {
                            Console.Write("Do you want to add another table order(Y/N): ");
                            confirm = Console.ReadLine();
                        }
                        if (confirm == "Y" || confirm == "y")
                        {
                            goto RepeatOrder;
                        }
                        else
                        {
                            goto startMenu;
                        }
                    } while (confirm == "N" || confirm == "n");
                    break;

                case 2:
                    var tableId = menuActor.DisplayOrderDetails(menuItems);
                    if (!(tableId == 0))
                    {
                        do
                        {
CancelOrder:
                            menuActor.GetInputFromUser(tableId);
                            Console.Write("Do you want more items to cancel(Y/N): ");
                            confirm = Console.ReadLine();
                            if (confirm == "Y" || confirm == "y")
                            {
                                goto CancelOrder;
                            }
                            else
                            {
                                goto startMenu;
                            }
                        } while (confirm == "N" || confirm == "n");
                    }
                    break;

                case 3:
                    var tableNo = Utility.GetInputForTable();
                    menuActor.DispalyViewBill(menuItems, tableNo);
                    break;

                case 4:
                    var tableNo1 = Utility.GetInputForTable();
                    menuActor.PayBill(menuItems, tableNo1);
                    break;

                case 5:
                    menuActor.ExitApplication();
                    break;
                }
                Console.Write("\nDo you still want to close the application (Y/N): ");
                confirm = Console.ReadLine();
                if (confirm == "N" || confirm == "n")
                {
                    goto startMenu;
                }
                else if (confirm == "Y" || confirm == "y")
                {
                    System.Environment.Exit(-1);
                }
            } while (confirm == "Y" || confirm == "y");
        }