Esempio n. 1
0
        protected void btnRefundment_Click(object sender, EventArgs e)
        {
            try
            {
                if (gvList.Rows.Count <= 0 || gvList.SelectedRowIndexArray.Length <= 0)
                {
                    return;
                }

                System.Web.UI.WebControls.Label lab = (System.Web.UI.WebControls.Label)gvList.Rows[gvList.SelectedRowIndexArray[0]].FindControl("Label1");
                if (lab.Text == "已退款")
                {
                    MessageBoxShow("已退款账单不能重复退款,请筛选出需要退款账单!");
                    return;
                }
                int[]  index = gvList.SelectedRowIndexArray;
                string ids   = "";
                for (int i = 0; i < index.Length; i++)
                {
                    ids += gvList.Rows[index[i]].Values[0].ToString() + ",";
                }
                Hashtable ht = new Hashtable();
                ht.Add("status", (int)daan.service.common.ParamStatus.BillheadStatus.Refundment);
                ht.Add("billheadid", ids.TrimEnd(','));
                BillheadService billheadservice = new BillheadService();
                billheadservice.BillUpdateBillheadRefundment(ht);
                string[] strs = ids.TrimEnd(',').Split(',');
                for (int i = 0; i < strs.Length; i++)
                {
                    billheadservice.AddOperationLog(strs[i], "", "现金接收", "作废订单", "节点信息", strs.Length > 1 ? "批量操作" : "");
                }
                MessageBoxShow("退款成功!");
                BindData();
            }
            catch (Exception ex)
            {
                MessageBoxShow(ex.Message, MessageBoxIcon.Error);
            }
        }
        /// <summary>
        /// 集中管理-作废订单
        /// </summary>
        public bool UpdateOrdersCancellation(string username, string strordernum, string reason)
        {
            bool   b   = true;
            string str = SelectOrderbarcodeByBill(strordernum);

            if (str == null && str == "")
            {
                Hashtable ht = new Hashtable();
                ht["cancelby"] = username;
                ht["ordernum"] = strordernum;
                ht["reason"]   = reason;
                try
                {
                    if (this.update("Order.Cancellation", ht) < 0)
                    {
                        b = false;
                    }
                }
                catch (Exception)
                {
                    b = false;
                }
            }
            else
            {
                SortedList SQLlist = new SortedList(new MySort());
                Hashtable  ht      = new Hashtable();
                ht["cancelby"] = username;
                ht["ordernum"] = strordernum;
                ht["reason"]   = reason;
                try
                {
                    SQLlist.Add(new Hashtable()
                    {
                        { "UPDATE", "Order.Cancellation" }
                    }, ht);
                    var      library = new BillheadService();
                    string[] order   = strordernum.TrimEnd(',').Split(',');
                    for (int j = 0; j < order.Count(); j++)
                    {
                        Orders orders = new ProRegisterService().SelectOrderInfo(order[j]);
                        if (orders.Ordersource == "0") //这里只修改个人体检账单
                        {
                            List <Billdetail> billdetail = new BilldetailService().GetBilldetailByOrderNum(order[j]);
                            if (billdetail.Count > 0)
                            {
                                for (int m = 0; m < billdetail.Count; m++)
                                {
                                    if (billdetail[m].Billheadid != null)
                                    {
                                        Hashtable htnew = new Hashtable();
                                        htnew.Add("status", (int)daan.service.common.ParamStatus.BillheadStatus.Invalid);
                                        htnew.Add("billheadid", billdetail[m].Billheadid);
                                        SQLlist.Add(new Hashtable()
                                        {
                                            { "UPDATE", "Bill.UpdateBillheadRefundment" }
                                        }, htnew);
                                    }
                                }
                            }
                            // outorderNum[0] = order[j];
                        }
                    }
                    if (library.ExecuteSqlTran(SQLlist))
                    {
                        b = true;
                    }
                }
                catch (Exception)
                {
                    b = false;
                }
            }
            return(b);
        }
Esempio n. 3
0
        /// <summary>
        ///  财务打印
        /// </summary>
        /// <param name="htinfo">报告单明细信息</param>
        /// <param name="flag">报告单数据来源标示:团检、现金接收</param>
        /// <param name="strwhere">获得打印明细信息的查询条件</param>
        /// <param name="checkbillid">财务清单核对人编号</param>
        /// <param name="dictlabid">分点编号</param>
        /// <returns>dataset:报告单数据集</returns>
        public DataSet ConvertToDataSet(Hashtable htinfo, string strwhere, string flag, double?checkbillid, double?dictlabid, string sendout)
        {
            try
            {
                LoginService      loginService  = new LoginService();
                BilldetailService detailservice = new BilldetailService();
                BillheadService   headservice   = new BillheadService();

                IList <Billhead>   headlist   = null;
                IList <Billdetail> detailList = null;
                DataSet            ds         = new DataSet();

                //获得打印明细信息
                if (flag == "billdetail")   //团检
                {
                    if (sendout == "nosendout")
                    {
                        detailList = detailservice.SelectBilldetailInfoList(strwhere);
                    }
                    else if (sendout == "sendout")
                    {
                        detailList = detailservice.SelectSendOutBillDetailInfoPrint(strwhere);
                    }
                }
                else                       //现金接收
                {
                    headlist = headservice.SelectBillHeadListForPrintByids(strwhere);
                }

                #region 设置报告单中间明细信息
                //生成财务账单详细信息
                DataTable  dt = new DataTable("tbdetail");
                DataColumn column;
                DataRow    dr = dt.NewRow();

                column = new DataColumn("Orderenterdate");
                dt.Columns.Add(column);
                column = new DataColumn("Ordernum");
                dt.Columns.Add(column);
                column = new DataColumn("Realname");
                dt.Columns.Add(column);
                column = new DataColumn("Productname");
                dt.Columns.Add(column);
                column = new DataColumn("Standardprice");
                dt.Columns.Add(column);
                column = new DataColumn("Finalprice");
                dt.Columns.Add(column);
                column = new DataColumn("Remark");
                dt.Columns.Add(column);

                if (detailList != null)
                {
                    foreach (Billdetail detail in detailList)
                    {
                        dr = dt.NewRow();
                        dr["Orderenterdate"] = detail.Orderenterdate.Value.ToString("yyyy-MM-dd");
                        dr["Ordernum"]       = detail.Ordernum;
                        dr["Realname"]       = detail.Realname;
                        dr["Productname"]    = detail.Productname;
                        dr["Standardprice"]  = detail.Standardprice;
                        dr["Finalprice"]     = detail.Finalprice;
                        dr["Remark"]         = detail.Remark;
                        dt.Rows.Add(dr);
                    }
                }
                else if (headlist != null)
                {
                    foreach (Billhead head in headlist)
                    {
                        dr = dt.NewRow();
                        dr["Orderenterdate"] = head.Orderenterdate.Value.ToString("yyyy-MM-dd");
                        dr["Ordernum"]       = head.Ordernum;
                        dr["Realname"]       = head.Realname;
                        dr["Productname"]    = head.Productname;
                        dr["Standardprice"]  = head.Totalstandardprice;
                        dr["Finalprice"]     = head.Totalfinalprice;
                        dr["Remark"]         = head.Remark;
                        dt.Rows.Add(dr);
                    }
                }
                ds.Tables.Add(dt);
                #endregion


                //获得销售人员、清单核对人、分点信息
                List <Dictuser>     userlist  = new List <Dictuser>();
                List <Dictlab>      labList   = new List <Dictlab>();
                List <Dictuser>     usercheck = new List <Dictuser>();
                List <Dictuser>     usersale  = new List <Dictuser>();
                List <Dictcustomer> customer  = new List <Dictcustomer>();

                userlist = loginService.GetDictuser();
                labList  = loginService.GetLoginDictlab();

                List <Dictlab> dictLabList = (from a in labList where a.Dictlabid == dictlabid select a).ToList <Dictlab>();

                if (flag == "billdetail")
                {
                    usercheck = (from a in userlist where a.Dictuserid == checkbillid select a).ToList <Dictuser>();
                }
                else
                {
                    //获取"个人客户"基本信息
                    List <Dictcustomer> customerList = loginService.GetDictcustomer();
                    int customercode = (int)ParamStatus.PersonalCustomerID.SingleCustomerCode;
                    customer = (from a in customerList where a.Customercode == customercode.ToString() select a).ToList();
                    if (customer.Count > 0)
                    {
                        usercheck = (from a in userlist where a.Dictuserid == customer[0].Dictcheckbillid select a).ToList();
                        usersale  = (from a in userlist where a.Dictuserid == customer[0].Dictsalemanid select a).ToList();
                    }
                }

                #region 设置报告单头尾信息
                //生成财务账单头尾信息
                DataTable  dtinfo = new DataTable("headinfo");
                DataColumn headcolumn;
                DataRow    headrow = dtinfo.NewRow();

                headcolumn = new DataColumn("customername");
                dtinfo.Columns.Add(headcolumn);
                headcolumn = new DataColumn("salename");
                dtinfo.Columns.Add(headcolumn);
                headcolumn = new DataColumn("checkbillname");
                dtinfo.Columns.Add(headcolumn);
                headcolumn = new DataColumn("phone");
                dtinfo.Columns.Add(headcolumn);
                headcolumn = new DataColumn("fax");
                dtinfo.Columns.Add(headcolumn);
                headcolumn = new DataColumn("website");
                dtinfo.Columns.Add(headcolumn);
                headcolumn = new DataColumn("totalstandardprice");
                dtinfo.Columns.Add(headcolumn);
                headcolumn = new DataColumn("totalfinalprice");
                dtinfo.Columns.Add(headcolumn);
                headcolumn = new DataColumn("begindate");
                dtinfo.Columns.Add(headcolumn);
                headcolumn = new DataColumn("enddate");
                dtinfo.Columns.Add(headcolumn);
                headcolumn = new DataColumn("customertype");
                dtinfo.Columns.Add(headcolumn);
                headcolumn = new DataColumn("ordernumcount");
                dtinfo.Columns.Add(headcolumn);

                if (flag == "billdetail")
                {
                    headrow["customername"]       = htinfo["customername"];
                    headrow["salename"]           = htinfo["salename"];
                    headrow["totalstandardprice"] = detailList.Sum(c => c.Standardprice);
                    headrow["totalfinalprice"]    = detailList.Sum(c => c.Finalprice);
                    headrow["ordernumcount"]      = detailList.Count;
                }
                else
                {
                    headrow["customername"]       = customer.Count > 0 ? customer[0].Customername : "";
                    headrow["salename"]           = usersale.Count > 0 ? usersale[0].Username : "";
                    headrow["totalstandardprice"] = headlist.Sum(c => c.Totalstandardprice);
                    headrow["totalfinalprice"]    = headlist.Sum(c => c.Totalfinalprice);
                    headrow["ordernumcount"]      = headlist.Count;
                }
                headrow["phone"] = "";
                headrow["fax"]   = "";

                if (dictLabList.Count > 0)
                {
                    if (!string.IsNullOrEmpty(dictLabList[0].Phone))
                    {
                        headrow["phone"] = "Tel:" + dictLabList[0].Phone;
                    }
                    if (!string.IsNullOrEmpty(dictLabList[0].Fax))
                    {
                        headrow["fax"] = "Fax:" + dictLabList[0].Fax;
                    }
                }
                headrow["website"]       = dictLabList.Count > 0 ? dictLabList[0].Website : "";
                headrow["checkbillname"] = usercheck.Count > 0 ? usercheck[0].Username : "";
                headrow["begindate"]     = htinfo["begindate"];
                headrow["enddate"]       = htinfo["enddate"];
                headrow["customertype"]  = htinfo["customertype"];

                dtinfo.Rows.Add(headrow);
                ds.Tables.Add(dtinfo);
                #endregion

                string titlename = htinfo["titleName"].ToString();

                #region 设置标题
                DataTable  dtt = new DataTable("dtTitle");
                DataRow    dtr;
                DataColumn dtc;

                dtc = new DataColumn("titleName");
                dtt.Columns.Add(dtc);
                dtr = dtt.NewRow();
                dtr["titleName"] = titlename;
                dtt.Rows.Add(dtr);
                ds.Tables.Add(dtt);
                #endregion

                return(ds);
            }
            catch
            {
                return(null);
            }
        }