123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.Dresses
- {
- public partial class DressOrderReportFormMain : LYFZ.Software.UI.Dresses.DressOrderReportFormMain
- {
- LYFZ.BLL.BLL_ErpSystemLogs slogbll = new BLL.BLL_ErpSystemLogs();
- LYFZ.BLL.BLL_ErpDressSendWashOrder sworbll = new BLL.BLL_ErpDressSendWashOrder();
- LYFZ.BLL.BLL_ErpDressSendWashDetail swodbll = new BLL.BLL_ErpDressSendWashDetail();
- LYFZ.BLL.BLL_ErpPayment ptbll = new BLL.BLL_ErpPayment();
- LYFZ.BLL.BLL_ErpDressRefundRecord rsrrbll = new BLL.BLL_ErpDressRefundRecord();
- LYFZ.BLL.BLL_ErpDressSaleRentalOrder rsorbll = new BLL.BLL_ErpDressSaleRentalOrder();
- LYFZ.BLL.BLL_ErpDressSaleRentalDetail rsodbll = new BLL.BLL_ErpDressSaleRentalDetail();
- LYFZ.BLL.BLL_ErpDressDepositReceivables rsdebll = new BLL.BLL_ErpDressDepositReceivables();
- public DressOrderReportFormMain()
- {
- this.Load += DressOrderReportFormMain_Load;
- this.Shown += DressOrderReportFormMain_Shown;
- this.btnQuery.Click += btnQuery_Click;
- this.btnConditionQuery.Click += btnConditionQuery_Click;
- this.btnReservation.Click += btnReservation_Click;
- this.btnDelete.Click += btnDelete_Click;
- this.btnPayment.Click += btnPayment_Click;
- this.btnReturnDeposit.Click += btnReturnDeposit_Click;
- this.btnReturnDress.Click += btnReturnDress_Click;
- this.btnExport.Click += btnExport_Click;
- this.btnPrint.Click += btnPrint_Click;
- this.btnCloseed.Click += btnCloseed_Click;
- this.listViewData.Click += listViewData_Click;
- this.listViewData.ColumnClick += listViewData_ColumnClick;
- this.listViewData.MouseDoubleClick += listViewData_MouseDoubleClick;
- this.txtDreesDay.KeyPress += txtDreesDay_KeyPress;
- this.chkOutRent.Click += chkOutRent_Click;
- this.chkOutSale.Click += chkOutSale_Click;
- this.chkPreselected.Click += chkPreselected_Click;
- this.chkSendWash.Click += chkSendWash_Click;
- this.chkArrears.Click += chkArrears_Click;
- this.chkShowCompleteOrder.Click += chkShowCompleteOrder_Click;
- this.Resize += DressOrderReportFormMain_Resize;
- this.ucPagerEx1.EventPaging += UcPagerEx1_EventPaging;
- }
- /// <summary>
- /// 相片集合
- /// </summary>
- ImageList mlistImage = new ImageList();
- /// <summary>
- /// 用于排序的类
- /// </summary>
- LYFZ.ComponentLibrary.ListViewColumnSorter lvwColumnSorter;
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void DressOrderReportFormMain_Load(object sender, EventArgs e)
- {
- this.listViewData.View = View.Details;
- this.listViewData.GridLines = true;
- this.mlistImage.ImageSize = new Size(1, 25);
- this.mlistImage.ColorDepth = ColorDepth.Depth32Bit;
- this.listViewData.SmallImageList = mlistImage;
- this.lvwColumnSorter = new ComponentLibrary.ListViewColumnSorter();
- this.listViewData.ListViewItemSorter = this.lvwColumnSorter;
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView(this.cmbtreevDressStatus, "取衣,还衣", IsFirstNodeNull: true, IsFirstNodeName: " ");
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void DressOrderReportFormMain_Shown(object sender, EventArgs e)
- {
- bool b = LYFZ.Software.MainBusiness.VersionControl.StaticVersion.UIFunctionVersion(VersionControl.VersionFunctionEnum.礼服管理);
- if (!b)
- {
- this.Close();
- return;
- }
- this.PublicFunctionRows();
-
- }
- /// <summary>
- /// 查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnQuery_Click(object sender, EventArgs e)
- {
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 条件查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnConditionQuery_Click(object sender, EventArgs e)
- {
- }
- /// <summary>
- /// 打开订单
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnReservation_Click(object sender, EventArgs e)
- {
- if (this.listViewData.Items.Count > 0 && this.listViewData.SelectedItems.Count > 0)
- {
- switch (this.listViewData.SelectedItems[0].SubItems["订单类型"].Text.Trim())
- {
- case "出租":
- case "出售":
- if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DressManagement, CustomAttributes.OperatingAuthority.Dress_Rental))
- { MessageBoxCustom.Show("您无修改租租售单权限"); return; }
- LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleSmallForm frmRentSale = new SetSmallForm.DressOpenOrderRentSaleSmallForm();
- frmRentSale.StrOrderNumber = this.listViewData.SelectedItems[0].Text.Trim();
- frmRentSale.LoadType = this.listViewData.SelectedItems[0].SubItems["订单类型"].Text.Trim();
- frmRentSale.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- frmRentSale.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- frmRentSale.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- frmRentSale.ShowDialog();
- if (frmRentSale.IsSaveed)
- { this.PublicFunctionRows(); }
- break;
- case "预选":
- if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DressManagement, CustomAttributes.OperatingAuthority.Dress_Preselection))
- { MessageBoxCustom.Show("您无修改预选单权限"); return; }
- LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrdePreselectedSmallForm frmPreselected = new SetSmallForm.DressOpenOrdePreselectedSmallForm();
- frmPreselected.StrOrderNumber = this.listViewData.SelectedItems[0].Text.Trim();
- frmPreselected.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- frmPreselected.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- frmPreselected.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- frmPreselected.ShowDialog();
- if (frmPreselected.IsSaveed)
- { this.PublicFunctionRows(); }
- break;
- case "送洗":
- if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DressManagement, CustomAttributes.OperatingAuthority.Dress_Valet))
- { MessageBoxCustom.Show("您无修改送洗单权限"); return; }
- LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderSendWashSmallForm frmSendWash = new SetSmallForm.DressOpenOrderSendWashSmallForm();
- frmSendWash.StrOrderNumber = this.listViewData.SelectedItems[0].Text.Trim();
- frmSendWash.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- frmSendWash.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- frmSendWash.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- frmSendWash.ShowDialog();
- if (frmSendWash.IsSaveed)
- { this.PublicFunctionRows(); }
- break;
- }
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDelete_Click(object sender, EventArgs e)
- {
- if (this.listViewData.Items.Count > 0 && this.listViewData.SelectedItems.Count > 0)
- {
- if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DressManagement, CustomAttributes.OperatingAuthority.Delete))
- {
- switch (this.listViewData.SelectedItems[0].SubItems["订单类型"].Text.Trim())
- {
- case "出租":
- case "出售":
- DataTable dt = ptbll.GetList("Pay_OrdNumber = '" + this.listViewData.SelectedItems[0].Text.Trim() + "'").Tables[0];
- if (dt.Rows.Count > 0)
- { MessageBoxCustom.Show("礼服订单已收款不能删除!"); return; }
- break;
- }
- List<LYFZ.Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
- switch (this.listViewData.SelectedItems[0].SubItems["订单类型"].Text.Trim())
- {
- case "出租":
- case "出售":
- case "预选":
- clist.Add(rsorbll.GetDeleteCommandInfo("Dsro_Number", "=", this.listViewData.SelectedItems[0].Text.Trim()));
- clist.Add(rsodbll.GetDeleteCommandInfo("Dsrd_Number", "=", this.listViewData.SelectedItems[0].Text.Trim()));
- clist.Add(rsrrbll.GetDeleteCommandInfo("DRR_Number", "=", this.listViewData.SelectedItems[0].Text.Trim()));
- clist.Add(rsdebll.GetDeleteCommandInfo("DDR_Number", "=", this.listViewData.SelectedItems[0].Text.Trim()));
- clist.Add(ptbll.GetDeleteCommandInfo("Pay_OrdNumber", "=", this.listViewData.SelectedItems[0].Text.Trim()));
- break;
- case "送洗":
- clist.Add(sworbll.GetDeleteCommandInfo("Dswo_Number", "=", this.listViewData.SelectedItems[0].Text.Trim()));
- clist.Add(swodbll.GetDeleteCommandInfo("Dswd_Number", "=", this.listViewData.SelectedItems[0].Text.Trim()));
- break;
- }
- string logsContent = "删除礼服" + this.listViewData.SelectedItems[0].SubItems["订单类型"].Text.Trim() + ",订单号:" + this.listViewData.SelectedItems[0].Text.Trim();
- clist.Add(slogbll.GetAddCommandInfo(LYFZ.BLL.BLL_ErpSystemLogs.GetWriteLogModel(LYFZ.EnumPublic.SystemLogsType.删除礼服, logsContent, LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name, StrInfoID: LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID())));
- if (clist.Count > 0)
- {
- if (MessageBoxCustom.Show("你确定要删除吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- { return; }
- if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
- {
- MessageBoxCustom.Show("删除成功!");
- this.listViewData.Items.Remove(this.listViewData.SelectedItems[0]);
- }
- else
- { MessageBoxCustom.Show("删除失败!"); }
- }
- }
- else
- { MessageBoxCustom.Show("您无删除权限"); return; }
- }
- }
- /// <summary>
- /// 收款
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnPayment_Click(object sender, EventArgs e)
- {
- if (this.listViewData.Items.Count > 0 && this.listViewData.SelectedItems.Count > 0)
- {
- if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DressManagement, CustomAttributes.OperatingAuthority.ReceivablesAll))
- {
- LYFZ.Software.MainBusiness.Dresses.DressManagement.Rental.FrmPayment frm = new DressManagement.Rental.FrmPayment();
- frm.StrOrderNumber = this.listViewData.SelectedItems[0].Text.Trim();
- frm.ShowDialog();
- if (frm.IsSaveed)
- { this.PublicFunctionRows(); }
- else
- { this.listViewData.Select(); }
- }
- else
- { MessageBoxCustom.Show("您无收款权限"); return; }
- }
- }
- /// <summary>
- /// 退押金
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnReturnDeposit_Click(object sender, EventArgs e)
- {
- if (this.listViewData.Items.Count > 0 && this.listViewData.SelectedItems.Count > 0)
- {
- LYFZ.Software.MainBusiness.Dresses.DressManagement.Rental.FrmRefundRecord frm = new DressManagement.Rental.FrmRefundRecord();
- frm.StrOrderNumber = this.listViewData.SelectedItems[0].Text.Trim();
- frm.ShowDialog();
- if (frm.IsSaveed)
- { this.PublicFunctionRows(); }
- else
- { this.listViewData.Select(); }
- }
- }
- /// <summary>
- /// 还回礼服
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnReturnDress_Click(object sender, EventArgs e)
- {
- if (this.listViewData.Items.Count > 0 && this.listViewData.SelectedItems.Count > 0)
- {
- LYFZ.Software.MainBusiness.Dresses.DressManagement.Rental.FrmAlsoBack frm = new DressManagement.Rental.FrmAlsoBack();
- frm.StrOrderNumber = this.listViewData.SelectedItems[0].Text.Trim();
- frm.OrderType = this.listViewData.SelectedItems[0].SubItems["订单类型"].Text.Trim();
- frm.ShowDialog();
- if (frm.IsSaveed)
- { this.PublicFunctionRows(); }
- else
- { this.listViewData.Select(); }
- }
- }
- /// <summary>
- /// 导出
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnExport_Click(object sender, EventArgs e)
- {
- this.listViewData.ListViewToDataTable(StrFileName: "礼服订单报表");
- }
- /// <summary>
- /// 打印
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnPrint_Click(object sender, EventArgs e)
- {
- if (this.listViewData.Items.Count > 0 && this.listViewData.SelectedItems.Count > 0)
- {
- switch (this.listViewData.SelectedItems[0].SubItems["订单类型"].Text.Trim())
- {
- case "出租":
- LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(LYFZ.EnumPublic.PrintTypeEnum.礼服出租清单, this.listViewData.SelectedItems[0].Text.Trim());
- break;
- case "出售":
- LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(LYFZ.EnumPublic.PrintTypeEnum.礼服出售清单, this.listViewData.SelectedItems[0].Text.Trim());
- break;
- }
- this.listViewData.Select();
- }
- }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnCloseed_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 列表点击事件(判断是订单类型)
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Click(object sender, EventArgs e)
- {
- if (this.listViewData.Items.Count > 0 && this.listViewData.SelectedItems.Count > 0)
- {
- switch (this.listViewData.SelectedItems[0].SubItems["订单类型"].Text.Trim())
- {
- case "出租":
- this.btnPayment.Enabled = true;
- this.btnReturnDeposit.Enabled = true;
- this.btnPrint.Enabled = true;
- this.btnReturnDress.Enabled = true;
- break;
- case "出售":
- this.btnPayment.Enabled = true;
- this.btnReturnDeposit.Enabled = false;
- this.btnPrint.Enabled = true;
- this.btnReturnDress.Enabled = false;
- break;
- case "预选":
- this.btnPayment.Enabled = false;
- this.btnReturnDeposit.Enabled = false;
- this.btnPrint.Enabled = false;
- this.btnReturnDress.Enabled = false;
- break;
- case "送洗":
- this.btnPayment.Enabled = false;
- this.btnReturnDeposit.Enabled = false;
- this.btnReturnDress.Enabled = true;
- this.btnPrint.Enabled = false;
- break;
- }
- }
- }
- /// <summary>
- /// 点击排序
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_ColumnClick(object sender, ColumnClickEventArgs e)
- {
- // 检查点击的列是不是现在的排序列.
- if (e.Column == lvwColumnSorter.SortColumn)
- {
- // 重新设置此列的排序方法.
- if (lvwColumnSorter.Order == SortOrder.Ascending)
- { lvwColumnSorter.Order = SortOrder.Descending; }
- else
- { lvwColumnSorter.Order = SortOrder.Ascending; }
- }
- else
- {
- // 设置排序列,默认为正向排序
- lvwColumnSorter.SortColumn = e.Column;
- lvwColumnSorter.Order = SortOrder.Ascending;
- }
- // 用新的排序方法对ListView排序
- this.listViewData.Sort();
- //LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData);
- for (int i = 0; i < this.listViewData.Items.Count; i++)
- {
- if ((i % 2) > 0)
- { this.listViewData.Items[i].BackColor = System.Drawing.Color.PapayaWhip; }
- else
- { this.listViewData.Items[i].BackColor = System.Drawing.Color.PowderBlue; }
- if (this.listViewData.Items[i].SubItems["欠款金额"] != null)
- {
- if (Convert.ToDecimal(this.listViewData.Items[i].SubItems["欠款金额"].Text.Trim()) > 0)
- { this.listViewData.Items[i].SubItems["欠款金额"].ForeColor = Color.Red; }
- }
- if (this.listViewData.Items[i].SubItems["应收押金"] != null && this.listViewData.Items[i].SubItems["已收押金"] != null)
- {
- if ((Convert.ToDecimal(this.listViewData.Items[i].SubItems["应收押金"].Text.Trim()) - Convert.ToDecimal(this.listViewData.Items[i].SubItems["已收押金"].Text.Trim())) > 0)
- { this.listViewData.Items[i].SubItems["已收押金"].ForeColor = Color.Red; }
- }
- }
- }
- /// <summary>
- /// 列表双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- if (this.listViewData.Items.Count > 0 && this.listViewData.SelectedItems.Count > 0)
- { this.btnReservation_Click(this, null); }
- }
- /// <summary>
- /// 出租
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkOutRent_Click(object sender, EventArgs e)
- {
- this.chkOutSale.Checked = false;
- this.chkSendWash.Checked = false;
- this.chkPreselected.Checked = false;
- this.chkArrears.Enabled = true;
- this.btnPayment.Enabled = true;
- this.btnReturnDeposit.Enabled = true;
- this.btnPrint.Enabled = true;
- this.btnReturnDress.Enabled = true;
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 出售
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkOutSale_Click(object sender, EventArgs e)
- {
- this.chkOutRent.Checked = false;
- this.chkSendWash.Checked = false;
- this.chkPreselected.Checked = false;
- this.chkArrears.Enabled = true;
- this.btnPayment.Enabled = true;
- this.btnReturnDeposit.Enabled = false;
- this.btnPrint.Enabled = true;
- this.btnReturnDress.Enabled = false;
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 预选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkPreselected_Click(object sender, EventArgs e)
- {
- this.chkSendWash.Checked = false;
- this.chkOutRent.Checked = false;
- this.chkOutSale.Checked = false;
- if (this.chkPreselected.Checked)
- {
- this.chkArrears.Checked = false;
- this.chkArrears.Enabled = false;
- this.btnPayment.Enabled = false;
- this.btnReturnDeposit.Enabled = false;
- this.btnPrint.Enabled = false;
- this.btnReturnDress.Enabled = false;
- }
- else
- {
- this.chkArrears.Enabled = true;
- this.btnPayment.Enabled = true;
- this.btnReturnDeposit.Enabled = true;
- this.btnPrint.Enabled = true;
- this.btnReturnDress.Enabled = true;
- }
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 送洗
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkSendWash_Click(object sender, EventArgs e)
- {
- this.chkOutRent.Checked = false;
- this.chkOutSale.Checked = false;
- this.chkPreselected.Checked = false;
- if (this.chkSendWash.Checked)
- {
- this.chkArrears.Checked = false;
- this.chkArrears.Enabled = false;
- this.btnPayment.Enabled = false;
- this.btnReturnDeposit.Enabled = false;
- this.btnReturnDress.Enabled = true;
- this.btnPrint.Enabled = false;
- }
- else
- {
- this.chkArrears.Enabled = true;
- this.btnPayment.Enabled = true;
- this.btnReturnDeposit.Enabled = true;
- this.btnReturnDress.Enabled = true;
- this.btnPrint.Enabled = true;
- }
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 欠款
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkArrears_Click(object sender, EventArgs e)
- {
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 显示完成订单
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkShowCompleteOrder_Click(object sender, EventArgs e)
- {
- this.PublicFunctionRows();
- }/// <summary>
- /// 显示数字
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtDreesDay_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar != 8 && !Char.IsDigit(e.KeyChar))
- { e.Handled = true; }
- }
- /// <summary>
- /// 窗体大小发生变化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void DressOrderReportFormMain_Resize(object sender, EventArgs e)
- {
- switch (this.panelShowCompleteOrder.Location.Y)
- {
- case 3: this.flowLayoutPanel1.Height = 34; break;
- case 37: this.flowLayoutPanel1.Height = 68; break;
- case 71: this.flowLayoutPanel1.Height = 102; break;
- }
- }
- /// <summary>
- /// 创建行
- /// </summary>
- private void PublicFunctionRows()
- {
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.PageSize = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPageSize();//3;分页条数
- this.ucPagerEx1.Bind();
- }
- /// <summary>
- /// 画分页
- /// </summary>
- /// <param name="e"></param>
- /// <returns></returns>
- private int UcPagerEx1_EventPaging(UCPager.EventPagingArg e)
- {
- this.listViewData.Clear();
- LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData();
- pageData.TableName = "BView_DressOrderReport";
- pageData.PageIndex = this.ucPagerEx1.PageCurrent;
- pageData.PageSize = this.ucPagerEx1.PageSize;
- pageData.QueryCondition = GetWhereStr();
- pageData.OrderStr = "录单时间 DESC";
- pageData.QueryFieldName = GetFieldName();
- DataTable dt = new DataTable();
- this.listViewData.BeginUpdate();
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- dt = pageData.QueryDataTable().Tables[0];
- try
- {
- this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
- {
- for (int i = 0; i < dt.Columns.Count; i++)
- {
- ColumnHeader ch = new ColumnHeader();
- ch.Text = dt.Columns[i].ColumnName.Trim();
- ch.TextAlign = HorizontalAlignment.Left;
- switch (dt.Columns[i].ColumnName.Trim())
- {
- case "订单号": ch.Width = 100; break;
- case "录单时间": ch.Width = 150; break;
- case "订单备注": ch.Width = 200; break;
- default: ch.Width = 100; break;
- }
- switch (dt.Columns[i].ColumnName.Trim())
- {
- case "应付金额":
- case "已付金额":
- case "欠款金额":
- case "应收押金":
- case "已收押金":
- case "未退押金":
- ch.TextAlign = HorizontalAlignment.Right;
- break;
- case "客户性别":
- case "取衣时间":
- case "还衣时间":
- case "录单时间":
- case "订单类型":
- case "是否还衣":
- ch.TextAlign = HorizontalAlignment.Center;
- break;
- default:
- ch.TextAlign = HorizontalAlignment.Left;
- break;
- }
- this.listViewData.Columns.Add(ch);
- }
- try
- {
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- ListViewItem lvItem = new ListViewItem();
- ListViewItem.ListViewSubItem ListSubItem = null;
- if ((i % 2) > 0)
- { lvItem.BackColor = System.Drawing.Color.PapayaWhip; }
- else
- { lvItem.BackColor = System.Drawing.Color.PowderBlue; }
- for (int j = 0; j < dt.Columns.Count; j++)
- {
- ListSubItem = new ListViewItem.ListViewSubItem();
- if (j == 0)
- { lvItem.Text = dt.Rows[i][j].ToString().Trim(); }
- else
- {
- ListSubItem.Name = dt.Columns[j].ColumnName.Trim();
- ListSubItem.Text = dt.Rows[i][j].ToString().Trim();
- if (dt.Columns[j].ColumnName.Trim() == "欠款金额")
- {
- if (Convert.ToDecimal(dt.Rows[i]["欠款金额"]) > 0)
- { lvItem.ForeColor = Color.Red; }
- }
- else if (dt.Columns[j].ColumnName.Trim() == "已收押金")
- {
- if ((Convert.ToDecimal(dt.Rows[i]["应收押金"]) - Convert.ToDecimal(dt.Rows[i]["已收押金"])) > 0)
- { lvItem.ForeColor = Color.Red; }
- }
- lvItem.SubItems.Add(ListSubItem);
- }
- }
- this.listViewData.Items.Add(lvItem);
- }
- }
- catch (Exception ex)
- { MessageBoxCustom.Show(ex.Message.Trim()); }
- }));
- }
- catch
- { }
- });
- this.listViewData.EndUpdate();
- try
- {
- this.ucPagerEx1.TbDataSource = dt;
- }
- catch { }
- //LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData);
- return pageData.TotalCount;
- }
- /// <summary>
- /// 查询要获取的字段
- /// </summary>
- /// <returns></returns>
- private string GetFieldName()
- {
- string autoNumber = "";
- if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.AutoDressOrderNumber)
- {
- autoNumber = "用户单号,";
- }
- if (this.chkSendWash.Checked)
- { return "订单号," + autoNumber + "订单类型,取衣时间,还衣时间,是否还衣,订单状态,录单人员,录单时间,订单备注"; }
- else if (this.chkPreselected.Checked)
- { return "订单号," + autoNumber + "客户姓名,客户电话,订单类型,接单人,订单状态,录单人员,录单时间,订单备注"; }
- else
- { return "订单号," + autoNumber + "客户姓名,客户电话,订单类型,应付金额,已付金额,欠款金额,应收押金,已收押金,未退押金,取衣时间,还衣时间,是否还衣,订单状态,接单人,录单人员,录单时间,订单备注"; }
- }
- /// <summary>
- /// 返回要操作的条件
- /// </summary>
- /// <returns></returns>
- private string GetWhereStr()
- {
- string StrWhere = " 1=1 ";
- string StrText = this.cmbTextQuery.Text.Trim();
- #region 查询条件
- if (StrText != "")
- {
- Hashtable htData = new Hashtable();
- htData["订单号"] = "";
- htData["客户姓名"] = "";
- htData["客户拼音"] = "";
- htData["客户电话"] = "";
- bool Isbl = true;
- if (LYFZ.Command.Command_Validate.IsNumber(StrText))
- {
- htData["客户电话"] = "1";
- Isbl = false;
- }
- else if (LYFZ.Command.Command_Validate.IsEnglish(StrText))
- {
- htData["订单号"] = "1";
- htData["客户拼音"] = "1";
- Isbl = false;
- }
- else if (LYFZ.Command.Command_Validate.IsChinese(StrText))
- {
- htData["客户姓名"] = "1";
- Isbl = false;
- }
- else if (Isbl)
- {
- htData["订单号"] = "1";
- htData["客户姓名"] = "1";
- htData["客户拼音"] = "1";
- htData["客户电话"] = "1";
- }
- string strV = "";
- int i = 0;
- foreach (DictionaryEntry dic in htData)
- {
- if (dic.Value.ToString().Trim() != "")
- {
- if (i == 0)
- { strV += dic.Key + " like '%" + StrText + "%'"; }
- else
- { strV += " or " + dic.Key + " like '%" + StrText + "%'"; }
- i++;
- }
- }
- if (strV != "")
- { StrWhere += " and (" + strV + ")"; }
- }
- else
- {
- if (!this.chkShowCompleteOrder.Checked)
- { StrWhere += " And 订单状态 = '未完' "; }
- else
- { StrWhere += " And 订单状态 = 'OK' "; }
- }
- #endregion
- if (this.chkOutRent.Checked)
- { StrWhere += " And 订单类型 = '出租'"; }
- else if (this.chkOutSale.Checked)
- { StrWhere += " And 订单类型 = '出售'"; }
- else if (this.chkPreselected.Checked)
- { StrWhere += " And 订单类型 = '预选'"; }
- else if (this.chkSendWash.Checked)
- { StrWhere += " And 订单类型 = '送洗'"; }
- if (this.chkArrears.Checked)
- { StrWhere += " And 欠款金额 > 0"; }
- if (this.txtDreesDay.Text.Trim().Length > 0 && this.cmbtreevDressStatus.Text.Trim().Length > 0)
- {
- switch (this.cmbtreevDressStatus.Text.Trim())
- {
- case "取衣":
- StrWhere += " And (DATEDIFF(day, GETDATE(), 取衣时间) between 0 and " + Convert.ToInt32(this.txtDreesDay.Text) + ")";
- break;
- case "还衣":
- StrWhere += " And (DATEDIFF(day, GETDATE(), 还衣时间) between 0 And " + Convert.ToInt32(this.txtDreesDay.Text) + ") And 是否还衣 = '未还'";
- break;
- }
- }
- return StrWhere;
- }
- }
- }
|