private Hashtable GetDetailSqlWhere(string billheadid) { PageUtil pageUtil = new PageUtil(gvDetail.PageIndex, gvDetail.PageSize); BilldetailService detailservice = new BilldetailService(); Hashtable ht = new Hashtable(); ht["billheadid"] = billheadid; ht["pageStart"] = pageUtil.GetPageStartNum(); ht["pageEnd"] = pageUtil.GetPageEndNum(); return(ht); }
protected void btnSave_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(Request["orderNum"]) || string.IsNullOrEmpty(Request["billheadid"])) { return; } BilldetailService detailService = new BilldetailService(); Hashtable ht = new Hashtable(); ht["ordernum"] = Request["orderNum"].ToString(); ht["billheadid"] = Request["billheadid"].ToString(); ht["remark"] = tbaRemark.Text.Trim(); ht["selfremark"] = tbaSelfRemark.Text.Trim(); detailService.UpdateBilldetailRemark(ht); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } 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); }
//重新计算合计的实收金额 private void TotalPrice() { try { List <Ordergrouptest> list = GetData(Request["ordernum"].ToString()); //定义保存修改实收价格的集合 List <Ordergrouptest> _newgrouptestList = new List <Ordergrouptest>(); list.ToList().ForEach(i => _newgrouptestList.Add(i.Copy <Ordergrouptest>())); //刷新折扣率 //double? discount = null; //if (!string.IsNullOrEmpty(tbDiscount.Text.Trim())) //{ // try // { // discount = Convert.ToDouble(tbDiscount.Text.Trim()); // if (discount <= 0 || discount > 1) { throw new Exception(); } // } // catch (Exception) // { // MessageBoxShow("折扣率输入只能输入(0-1]之间的数字!"); return; // } // foreach (Ordergrouptest test in _newgrouptestList) // { // //如果有折扣率 实收价格 = 实收价格*折扣率 // test.Finalprice = test.Standardprice * discount; // } //} for (int i = 0; i < gvList.Rows.Count; i++) { System.Web.UI.WebControls.TextBox tbxfinalprice = (System.Web.UI.WebControls.TextBox)gvList.Rows[i].FindControl("tbxFinalprice"); double?finalprice = null; if (string.IsNullOrEmpty(tbxfinalprice.Text.Trim())) { MessageBoxShow("实收价格不能为空!"); return; } finalprice = double.Parse(tbxfinalprice.Text.Trim().ToString()); //判断集合中实收价格是否有修改 if (gvList.Rows[i].Values[0] == list[i].Ordergrouptestid.ToString() && list[i].Finalprice != finalprice) { _newgrouptestList[i].Finalprice = finalprice; } } tbxModifytotalprice.Text = _newgrouptestList.Sum(c => c.Finalprice).ToString(); //修改实收价格 BilldetailService service = new BilldetailService(); string ordernum = Request["ordernum"].ToString(); double dictlabid = double.Parse(ViewState["dictlabid"].ToString()); double? dictcustomerid = null; if (ViewState["dictcustomerid"] != null) { dictcustomerid = Convert.ToDouble(ViewState["dictcustomerid"].ToString()); } bool result = service.BillIndividualUpdatePrice(list, _newgrouptestList, dictcustomerid, ordernum, dictlabid, txtareaRemark.Text.Trim()); if (result) { MessageBoxShow("操作成功 !"); btnSave.Enabled = false; btnPrint.Enabled = true; gvList.DataSource = _newgrouptestList; gvList.DataBind(); //刷新gridview文本框的值 //if (string.IsNullOrEmpty(tbDiscount.Text.Trim())) // return; //for (int i = 0; i < gvList.Rows.Count; i++) //{ // System.Web.UI.WebControls.TextBox tbxFinalprice = (System.Web.UI.WebControls.TextBox)gvList.Rows[i].FindControl("tbxFinalprice"); // if (!string.IsNullOrEmpty(tbxFinalprice.Text)) // tbxFinalprice.Text = Convert.ToString(double.Parse(tbxFinalprice.Text)); //} } } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } }
/// <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); } }