123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835 |
- using LYFZ.ComponentLibrary;
- using LYFZ.Software.MainBusiness.FinancialManagement.SetSmallForm;
- 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.FinancialManagement
- {
- public partial class FrmFrmOrdersReceivables : LYFZ.Software.UI.FinancialManagement.FrmFrmOrdersReceivables
- {
- private delegate void UpdateControl();
- List<LYFZ.Software.MainBusiness.EnumPermissions.BusinessType> Versions = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessTypeList();
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- public FrmFrmOrdersReceivables()
- {
- this.Load += FrmFrmOrdersReceivables_Load;
- this.btnExport.Click += btnExport_Click;
- this.btnPrePayment.Click += btnPrePayment_Click;
- this.btnLatePayment.Click += btnLatePayment_Click;
- this.btnClose.Click += btnClose_Click;
- this.btnSlect.Click += btnSlect_Click;
- this.btnConditionQuery.Click += btnConditionQuery_Click;
- this.chkArrears.Click += chkqk_Click;
- this.chkQJ.Click += chkQJ_Click;
- this.Shown += FrmFrmOrdersReceivables_Shown;
- this.chkDressVersion.Click += chkHs_Click;
- this.chkKidsVersion.Click += chkEt_Click;
- this.chkPortraitVersion.Click += chkXz_Click;
- this.chkFw.Click += chkFw_Click;
- this.chkHQ.Click += chkHQ_Click;
- this.Resize += FrmFrmOrdersReceivables_Resize;
- this.dgvData.CellClick += dgv_CellClick;
- this.dgvData.MouseDoubleClick += dgv_MouseDoubleClick;
- this.dgvData.ColumnHeaderMouseClick += dgv_ColumnHeaderMouseClick;
- this.cmbtreevStoreName.ComboBoxTree_NodeMouseClick += cmbtreevStoreName_ComboBoxTree_NodeMouseClick;
- this.ucPagerEx1.EventPaging += ucPagerEx1_EventPaging;
- this.cmbQueryText.KeyDown += CmbQueryText_KeyDown;
- }
- private void CmbQueryText_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- btnSlect_Click(null,null);
- }
- }
- int ucPagerEx1_EventPaging(UCPager.EventPagingArg e)
- {
- //pageData.PageSize = LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ReportFormPageSize;
- this.ucPagerEx1.PageSize = LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ReportFormPageSize;
- PublicFunctionRows();
- return ucPagerEx1.NMax;
- }
- public void BindPageData(int pageIndx, int pageSize, int totalCount)
- {
- ucPagerEx1.NMax = totalCount;
- ucPagerEx1.CurrentPageCount = (pageSize);
- ucPagerEx1.PageCurrent = pageIndx;
- }
- /// <summary>
- /// 查询条件
- /// </summary>
- private Dictionary<string, string> DictData = new Dictionary<string, string>();
- /// <summary>
- /// 员工编号
- /// </summary>
- string StrUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- /// <summary>
- /// 列表单击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgv_CellClick(object sender, DataGridViewCellEventArgs e)
- {
- if (this.dgvData.CurrentRow != null)
- {
- LYFZ.BLL.BLL_ErpOrder.CurrentSelectedOrderNumber = this.dgvData.CurrentRow.Cells["订单号"].Value.ToString().Trim();
- }
- }
- /// <summary>
- /// 对列表控件双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgv_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- Point hit = this.dgvData.PointToClient(Cursor.Position);
- DataGridView.HitTestInfo hitTest = this.dgvData.HitTest(hit.X, hit.Y);
- if (hitTest.RowIndex < 0 && hitTest.ColumnIndex < 0)
- {
- if (!string.IsNullOrEmpty(this.cmbQueryText.Text.Trim()))
- {
- LYFZ.BLL.BLL_ErpOrder.CurrentSelectedOrderNumber = "";
- this.cmbQueryText.Text = "";
- //this.PublicFunctionRows();
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.Bind();
- }
- }
- }
- bool IsFirstRun = true;
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void FrmFrmOrdersReceivables_Load(object sender, EventArgs e)
- {
- this.PublicFunctionRights();
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void FrmFrmOrdersReceivables_Shown(object sender, EventArgs e)
- {
- //this.PublicFunctionRows();
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.Bind();
- this.IsFirstRun = false;
- this.FrmFrmOrdersReceivables_Resize(this, null);
- }
- /// <summary>
- /// 前期收款
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnPrePayment_Click(object sender, EventArgs e)
- {
- if (this.dgvData.SelectedRows.Count == 0)
- { MessageBoxCustom.Show("请选中你要收款的客户!"); return; }
- LYFZ.Software.MainBusiness.FinancialManagement.OrdersReceivables.FrmPrePayment frm = new OrdersReceivables.FrmPrePayment();
- frm.IsShowButtonPayment = false;
- //frm.StrOrdType = dgv.CurrentRow.Cells["Ord_Type"].Value.ToString();
- frm.StrOrdNumber = this.dgvData.CurrentRow.Cells["Ord_Number"].Value.ToString();
- //frm.StrCope = Convert.ToDecimal(dgv.CurrentRow.Cells["Cope"].Value);
- //frm.StrPaid = Convert.ToDecimal(dgv.CurrentRow.Cells["Paid"].Value);
- //frm.StrArrears = Convert.ToDecimal(dgv.CurrentRow.Cells["Arrears"].Value);
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- //this.PublicFunctionRows();
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.Bind();
- }
- }
- /// <summary>
- /// 后期收款
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnLatePayment_Click(object sender, EventArgs e)
- {
- if (this.dgvData.SelectedRows.Count == 0)
- { MessageBoxCustom.Show("请选中你要收款的客户!"); return; }
- LYFZ.Software.MainBusiness.FinancialManagement.OrdersReceivables.FrmLatePayment frm = new OrdersReceivables.FrmLatePayment();
- frm.StrOrdType = this.dgvData.CurrentRow.Cells["订单类型"].Value.ToString();
- frm.StrOrdNumber = this.dgvData.CurrentRow.Cells["Ord_Number"].Value.ToString();
- frm.StrCope = Convert.ToDecimal(this.dgvData.CurrentRow.Cells["应付"].Value);
- frm.StrPaid = Convert.ToDecimal(this.dgvData.CurrentRow.Cells["已付"].Value);
- frm.StrArrears = Convert.ToDecimal(this.dgvData.CurrentRow.Cells["欠款"].Value);
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- //this.PublicFunctionRows();
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.Bind();
- }
- }
- /// <summary>
- /// 列表双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgv_DoubleClick(object sender, EventArgs e)
- {
- //try
- //{
- // if (dgv.Rows.Count > 0)
- // {
- // #region 订单收款
- // if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OrdersReceivablesCompetence, CustomAttributes.OperatingAuthority.OrdersReceivables))
- // {
- // btnPrePayment.Enabled = true;
- // btnLatePayment.Enabled = true;
- // }
- // else
- // {
- // btnPrePayment.Enabled = false;
- // btnLatePayment.Enabled = false;
- // return;
- // }
- // #endregion
- // if (this.dgv.SelectedRows.Count == 0)
- // {
- // MessageBoxCustom.Show("请选中你要收款的客户!");
- // return;
- // }
- // string Ord_Type = dgv.CurrentRow.Cells["Ord_Type"].Value.ToString();
- // if (Ord_Type == "婚纱订单")
- // {
- // LYFZ.Software.MainBusiness.FinancialManagement.OrdersReceivables.FrmSelectCategory set = new OrdersReceivables.FrmSelectCategory();
- // set.Type = "婚纱版";
- // set.Ord_Number = dgv.CurrentRow.Cells["Ord_Number"].Value.ToString();
- // set.Cope = Convert.ToDecimal(dgv.CurrentRow.Cells["Cope"].Value);
- // set.Paid = Convert.ToDecimal(dgv.CurrentRow.Cells["Paid"].Value);
- // set.Arrears = Convert.ToDecimal(dgv.CurrentRow.Cells["Arrears"].Value);
- // set.ShowDialog();
- // if (set.Rx == "ok")
- // {
- // Bind();
- // }
- // }
- // if (Ord_Type == "儿童订单")
- // {
- // LYFZ.Software.MainBusiness.FinancialManagement.OrdersReceivables.FrmSelectCategory set = new OrdersReceivables.FrmSelectCategory();
- // set.Type = "儿童版";
- // set.Ord_Number = dgv.CurrentRow.Cells["Ord_Number"].Value.ToString();
- // set.Cope = Convert.ToDecimal(dgv.CurrentRow.Cells["Cope"].Value);
- // set.Paid = Convert.ToDecimal(dgv.CurrentRow.Cells["Paid"].Value);
- // set.Arrears = Convert.ToDecimal(dgv.CurrentRow.Cells["Arrears"].Value);
- // if (set.ShowDialog() == DialogResult.OK)
- // {
- // Bind();
- // }
- // }
- // if (Ord_Type == "写真订单")
- // {
- // LYFZ.Software.MainBusiness.FinancialManagement.OrdersReceivables.FrmSelectCategory set = new OrdersReceivables.FrmSelectCategory();
- // set.Type = "写真版";
- // set.Ord_Number = dgv.CurrentRow.Cells["Ord_Number"].Value.ToString();
- // set.Cope = Convert.ToDecimal(dgv.CurrentRow.Cells["Cope"].Value);
- // set.Paid = Convert.ToDecimal(dgv.CurrentRow.Cells["Paid"].Value);
- // set.Arrears = Convert.ToDecimal(dgv.CurrentRow.Cells["Arrears"].Value);
- // if (set.ShowDialog() == DialogResult.OK)
- // {
- // Bind();
- // }
- // }
- // if (Ord_Type == "服务订单")
- // {
- // LYFZ.Software.MainBusiness.FinancialManagement.OrdersReceivables.FrmSelectCategory set = new OrdersReceivables.FrmSelectCategory();
- // set.Type = "服务版";
- // set.Ord_Number = dgv.CurrentRow.Cells["Ord_Number"].Value.ToString();
- // set.Cope = Convert.ToDecimal(dgv.CurrentRow.Cells["Cope"].Value);
- // set.Paid = Convert.ToDecimal(dgv.CurrentRow.Cells["Paid"].Value);
- // set.Arrears = Convert.ToDecimal(dgv.CurrentRow.Cells["Arrears"].Value);
- // if (set.ShowDialog() == DialogResult.OK)
- // {
- // Bind();
- // }
- // }
- // }
- //}
- //catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
- }
- /// <summary>
- /// 写真
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkXz_Click(object sender, EventArgs e)
- {
- if (this.chkPortraitVersion.Checked)
- {
- this.chkDressVersion.Checked = false;
- this.chkKidsVersion.Checked = false;
- this.chkFw.Checked = false;
- this.chkHQ.Checked = false;
- }
- this.cmbQueryText.Text = "";
- //this.PublicFunctionRows();
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.Bind();
- }
- /// <summary>
- /// 儿童
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkEt_Click(object sender, EventArgs e)
- {
- if (this.chkKidsVersion.Checked)
- {
- this.chkDressVersion.Checked = false;
- this.chkFw.Checked = false;
- this.chkPortraitVersion.Checked = false;
- this.chkHQ.Checked = false;
- }
- this.cmbQueryText.Text = "";
- //this.PublicFunctionRows();
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.Bind();
- }
- /// <summary>
- /// 婚纱
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkHs_Click(object sender, EventArgs e)
- {
- if (this.chkDressVersion.Checked)
- {
- this.chkKidsVersion.Checked = false;
- this.chkFw.Checked = false;
- this.chkPortraitVersion.Checked = false;
- this.chkHQ.Checked = false;
- }
- //this.PublicFunctionRows();
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.Bind();
- }
- /// <summary>
- /// 服务
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkFw_Click(object sender, EventArgs e)
- {
- if (this.chkFw.Checked)
- {
- this.chkDressVersion.Checked = false;
- this.chkKidsVersion.Checked = false;
- this.chkPortraitVersion.Checked = false;
- this.chkHQ.Checked = false;
- }
- this.cmbQueryText.Text = "";
- //this.PublicFunctionRows();
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.Bind();
- }
- /// <summary>
- /// 婚庆
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkHQ_Click(object sender, EventArgs e)
- {
- if (this.chkHQ.Checked)
- {
- this.chkDressVersion.Checked = false;
- this.chkKidsVersion.Checked = false;
- this.chkPortraitVersion.Checked = false;
- this.chkFw.Checked = false;
- }
- this.cmbQueryText.Text = "";
- //this.PublicFunctionRows();
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.Bind();
- }
- /// <summary>
- /// 查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSlect_Click(object sender, EventArgs e)
- {
- this.DictData.Clear();
- //this.PublicFunctionRows();
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.Bind();
- }
- /// <summary>
- /// 条件查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnConditionQuery_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ConditionQuerySamllForm frm = new DoorCityProcess.SetSmallForm.ConditionQuerySamllForm();
- frm.LoadType = "订单收款";
- frm.ShowDialog();
- if (frm.DictDataArray.Count > 0)
- {
- this.DictData.Clear();
- this.cmbQueryText.Text = "";
- this.DictData = frm.DictDataArray;
- //this.PublicFunctionRows();
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.Bind();
- }
- }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnClose_Click(object sender, EventArgs e)
- { this.Close(); }
- /// <summary>
- /// 分店选择查询数据
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void cmbtreevStoreName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
- {
- this.PublicFunctionRights();
- //this.PublicFunctionRows();
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.Bind();
- }
- /// <summary>
- /// 选择分店获取权限
- /// </summary>
- void PublicFunctionRights()
- {
- this.panelEx8.Visible = false;
- this.panelEx9.Visible = false;
- this.panelEx7.Visible = false;
- for (int i = 0; i < Versions.Count; i++)
- {
- LYFZ.Software.MainBusiness.EnumPermissions.BusinessType Version = Versions[i];
- if (Version.ToString() == EnumPermissions.BusinessType.写真版.ToString())
- { this.panelEx9.Visible = true; }
- if (Version.ToString() == EnumPermissions.BusinessType.婚纱版.ToString())
- { this.panelEx7.Visible = true; }
- if (Version.ToString() == EnumPermissions.BusinessType.儿童版.ToString())
- { this.panelEx8.Visible = true; }
- }
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindGroupStoreName(this.cmbtreevStoreName, StrGroupKeyCode: "st015", StrKeyCode: "st016");
- if (this.cmbtreevStoreName.Nodes.Count <= 0)
- { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindGroupStoreName(this.cmbtreevStoreName, StrKeyCode: "st016"); }
- this.btnPrePayment.Enabled = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupStoreRights(this.cmbtreevStoreName, "OrdersReceivablesCompetence", CustomAttributes.OperatingAuthority.OrdersReceivables);
- this.btnLatePayment.Enabled = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupStoreRights(this.cmbtreevStoreName, "OrdersReceivablesCompetence", CustomAttributes.OperatingAuthority.OrdersLatePayment);
- if (!btnLatePayment.Enabled)
- { this.btnLatePayment.Enabled = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupStoreRights(this.cmbtreevStoreName, "OrdersReceivablesCompetence", CustomAttributes.OperatingAuthority.OrdersLatePickGoods); }
- this.btnExport.Enabled = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupStoreRights(this.cmbtreevStoreName, "OrdersReceivablesCompetence", CustomAttributes.OperatingAuthority.DataExport);
- }
- /// <summary>
- /// 欠款
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkqk_Click(object sender, EventArgs e)
- {
- //PublicFunctionRows();
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.Bind();
- }
- /// <summary>
- /// 取件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkQJ_Click(object sender, EventArgs e)
- {
- //PublicFunctionRows();
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.Bind();
- }
- /// <summary>
- /// 导出
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnExport_Click(object sender, EventArgs e)
- {
- //this.dgvData.ExportDataTable();
- frmExprortSelect frmExprort = new frmExprortSelect();
- if(frmExprort.ShowDialog()== DialogResult.OK)
- {
- DataTable NewTable=null;
- string strWhere ="";
- if (frmExprort.bcheckType==2)
- {
- strWhere = " and 1 = 1";
- }
- else if (frmExprort.bcheckType == 1)
- {
- strWhere = StrWhere();
- }
- SaveFileDialog saveFile = new SaveFileDialog();
- saveFile.Title = "导出数据报表文件";
- saveFile.Filter = "EXECL文件(*.xls) |*.xls |文本文件(*.txt) |*.txt |所有文件(*.*) |*.*";
- saveFile.FilterIndex = 1;
- DialogResult drst = saveFile.ShowDialog();
- if (drst == DialogResult.No || drst == DialogResult.Cancel || drst == DialogResult.No || drst == DialogResult.Abort)
- {
- return;
- }
- DataSet dtSet;
- string StrGuidName = LYFZ.EnumPublic.dgvGuidName.E_FormAll_A0045.ToString().Trim();
- Dictionary<string, string> dictColumns = LYFZ.DAL.DAL_GridViewDisplayIndex.GetGridViewShowColumns(this.StrUserID, StrGuidName, this.dgvData.dgvCurrentColumnOriginalSet);
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- dtSet = LYFZ.BLL.BLL_ErpOrderView.GetData_OrderPayment1(dictColumns, strWhere, this.StrSortField);
- NewTable = dtSet.Tables[0];
- });
- // List<string> ColumnNamesList = new List<string>();
- // ColumnNamesList.AddRange(dictColumns.Keys);
- LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate (object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
- {
- try
- {
- if (LYFZ.WinAPI.CustomPublicMethod.DataGridViewToExcel(saveFile.FileName.Trim(), NewTable, null, backgroundWorker))
- {
- MessageBoxCustom.Show("数据导出成功!");
- }
- else
- {
- MessageBoxCustom.Show("数据导出失败!");
- }
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show(String.Format("导出数据出错:{0}", ex.Message));
- }
- });
- /* List<DataTable> sheetList = new List<DataTable>();
- if (NewTable.Rows.Count > 60000)
- {
- int totalPage = (NewTable.Rows.Count / 60000) + ((NewTable.Rows.Count % 60000) > 0 ? 1 : 0);
- for (int i = 0; i < totalPage; i++)
- {
- DataTable dt = new DataTable();
- if (i == (totalPage - 1) && (NewTable.Rows.Count % 60000) > 0)
- {
- dt = NewTable.AsEnumerable().Skip(i * 60000).Take(NewTable.Rows.Count % 60000).CopyToDataTable();
- }
- else
- {
- dt = NewTable.AsEnumerable().Skip(i * 60000).Take(60000).CopyToDataTable();
- }
- sheetList.Add(dt);
- }
- }
- else
- {
- sheetList.Add(NewTable);
- }
- if (sheetList.Count > 0)
- {
- for (int i = 0; i < sheetList.Count; i++)
- {
- string ext = System.IO.Path.GetExtension(saveFile.FileName.Trim());
- string filePath = saveFile.FileName.Trim();
- string dirPath = System.IO.Path.GetDirectoryName(saveFile.FileName.Trim());
- string fileName = System.IO.Path.GetFileName(saveFile.FileName.Trim());
- if (sheetList.Count > 1)
- {
- filePath = dirPath+ "\\" + fileName.Replace("ext", "") + "(" + (i + 1) + ")" + ext;
- }
- LYFZ.Command.Command_ExportExcel.DataTable2Sheet(filePath, sheetList[i], "Sheet1", IsCoveredExistingFile: true);
- }
- MessageBoxCustom.Show("导出成功!");
- }
- else
- {
- MessageBoxCustom.Show("导出失败!");
- }
- */
- }
- }
- /// <summary>
- /// 窗体大小发生变化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void FrmFrmOrdersReceivables_Resize(object sender, EventArgs e)
- {
- switch (this.panelArrears.Location.Y)
- {
- case 4:
- this.flowLayoutPanel1.Height = 38;
- break;
- case 38:
- this.flowLayoutPanel1.Height = 70;
- break;
- }
- //if (!this.IsFirstRun)
- //{
- // int ControlsWidth = 0;
- // int ForCount = 0;
- // for (int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++)
- // {
- // if (this.flowLayoutPanel1.Controls[i].Visible)
- // {
- // ForCount++;
- // ControlsWidth += this.flowLayoutPanel1.Controls[i].Width;
- // }
- // }
- // ControlsWidth += ForCount * 5;
- // int strWidth = this.Width;
- // if (strWidth > ControlsWidth)
- // {
- // this.flowLayoutPanel1.Height = 40;
- // }
- // else
- // {
- // this.flowLayoutPanel1.Height = 70;
- // }
- //}
- }
- /// <summary>
- /// 点击列标头排序
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgv_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
- {
- if (e.Button == MouseButtons.Left)
- {
- string StrColumnName = GetOrderByName(this.dgvData.Columns[e.ColumnIndex].Name.Trim());
- if (StrColumnName == this.StrCurrentClickField || string.IsNullOrEmpty(this.StrCurrentClickField))
- {
- if (this.StrSortOrder == "ASC")
- { this.StrSortOrder = "DESC"; }
- else
- { this.StrSortOrder = "ASC"; }
- }
- else
- { this.StrSortOrder = "DESC"; }
- if (!string.IsNullOrEmpty(StrColumnName))
- {
- this.StrSortField = StrColumnName + " " + this.StrSortOrder;
- this.StrCurrentClickField = StrColumnName;
- }
- //this.PublicFunctionRows();
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.Bind();
- }
- }
- string GetOrderByName(string StrColumnName)
- {
- switch (StrColumnName)
- {
- case "订单号": return "Ord_SinceOrderNumber";
- case "客户姓名": return "Cus_Name";
- case "客户性别": return "Cus_Sex_cs";
- case "客户电话": return "Cus_Telephone";
- case "订单类型": return "Ord_Type";
- case "接单人": return "Ord_OrderPersonName";
- case "套系名称": return "Ord_SeriesName";
- case "套系价格": return "Ord_SeriesPrice";
- case "加急": return "IsExpedited";
- case "加急日期": return "ExpeditedTime";
- case "拍摄名称": return "Ordpg_Sights";
- case "拍照状态": return "Ordpg_PhotographyStatus";
- case "初修师": return "Ordv_EarlyRepairName";
- case "初修日期": return "Ordv_EarlyRepairTime";
- case "初修状态": return "Ordv_EarlyRepairStatus";
- case "选片状态": return "Ordv_FilmSelectionStatus";
- case "精修状态": return "Ordv_RefinementStatus";
- case "精修日期": return "Ordv_RefinementTime";
- case "设计状态": return "Ordv_DesignerStatus";
- case "设计师": return "Ordv_DesignerName";
- case "设计日期": return "Ordv_DesignerTime";
- case "看版师": return "Ordv_LookDesignName";
- case "看版日期": return "Ordv_LookDesignTime";
- case "看版状态": return "Ordv_LookDesignStatus";
- case "看版要求": return "Ordv_LookDesignClaim";
- //case "取件状态": return "Ords_ProductPickupIntStatus";
- case "相片名称": return "Opps_PhotoName";
- case "数量": return "Opps_PhotoQuantity";
- case "面积": return "Opps_PhotoArea";
- case "发出状态": return "Opps_SendVendor";
- case "发出日期": return "Opps_SendTime";
- case "返工状态": return "Opps_ReworkStatus";
- case "返工日期": return "Opps_ReworkTime";
- case "完成状态": return "Opps_CompletedStatus";
- case "完成日期": return "Opps_CompletedTime";
- case "会员卡号": return "Mc_CradNumber";
- default: return "";
- }
- }
- /// <summary>
- /// 当前点击的字段
- /// </summary>
- string StrCurrentClickField = "";
- /// <summary>
- /// 排序字段
- /// </summary>
- string StrSortField = "Ord_CreateDateTime DESC";
- /// <summary>
- /// 排序顺序
- /// </summary>
- string StrSortOrder = "DESC";
- /// <summary>
- /// 获取数据
- /// </summary>
- void PublicFunctionRows()
- {
- this.dgvData.dgvCurrentColumnOriginalSet = "Ord_Number,订单号,客户姓名,客户电话,应付,前期,后期,已付,欠款,订单类型,套系类别,接单人,套系名称,套系价格,订单时间,取件状态,会员卡号,储值欠款,服务欠款";
- string StrGuidName = "";//LYFZ.EnumPublic.dgvGuidName.E_FormAll_A0045.ToString().Trim();
- if ((LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.MemberCardShowHide))
- {
- this.dgvData.dgvFixedHideColumn = "Ord_Number,会员卡号";
- }
- else
- {
- this.dgvData.dgvFixedHideColumn = "Ord_Number";
- }
- this.dgvData.dgvGuidName = StrGuidName;
- this.dgvData.dgvUserEmployeeID = this.StrUserID;
- Dictionary<string, string> dictColumns = LYFZ.DAL.DAL_GridViewDisplayIndex.GetGridViewShowColumns(this.StrUserID, StrGuidName, this.dgvData.dgvCurrentColumnOriginalSet);
- this.dgvData.dictShowColumName = dictColumns;
- string StrQueryCondition = "";
- StrQueryCondition = StrWhere();
- //if (IsFirstRun && !string.IsNullOrEmpty(LYFZ.BLL.BLL_ErpOrder.CurrentSelectedOrderNumber))
- //{
- // string StrWhere = " And Ord_SinceOrderNumber = '" + LYFZ.BLL.BLL_ErpOrder.CurrentSelectedOrderNumber + "'";
- // this.cmbQueryText.Text = LYFZ.BLL.BLL_ErpOrder.CurrentSelectedOrderNumber;
- // StrQueryCondition = StrWhere + LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupQueryOrderClickWhere(this.cmbtreevStoreName, "Ord_DividedShop");
- //}
- //else
- //{
- // StrQueryCondition = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupQueryWhere(this.cmbtreevStoreName, "Ord_DividedShop");
- // if (this.cmbQueryText.Text.Trim().Length > 0)
- // { StrQueryCondition += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetQueryTextQueryCondition(this.cmbQueryText.Text.Trim()); }
- // else
- // {
- // if (this.chkQJ.Checked)
- // {
- // //StrQueryCondition += " And ((select Count(ID) from tb_ErpOrderDigitalStatus where Ords_OrdNumber = Ord_Number) * 2 = (select Sum(Ords_ProductPickupIntStatus) from tb_ErpOrderDigitalStatus where Ords_OrdNumber = Ord_Number))";
- // StrQueryCondition += " And asOrderPickupAndServiceStatus.Ords_ProductPickupStatus = 2 ";
- // }
- // else
- // {
- // //StrQueryCondition += " And ((select Count(ID) from tb_ErpOrderDigitalStatus where Ords_OrdNumber = Ord_Number) * 2 != (select Sum(Ords_ProductPickupIntStatus) from tb_ErpOrderDigitalStatus where Ords_OrdNumber = Ord_Number))";
- // StrQueryCondition += " And asOrderPickupAndServiceStatus.Ords_ProductPickupStatus != 2 ";
- // }
- // if (this.chkArrears.Checked)
- // { StrQueryCondition += " And (套系金额 + isnull(加挑金额, 0) - isnull(收款金额, 0)) > 0"; }
- // if (this.chkDressVersion.Checked)
- // { StrQueryCondition += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.婚纱订单).ToString() + "'"; }
- // else if (this.chkKidsVersion.Checked)
- // { StrQueryCondition += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.儿童订单).ToString() + "'"; }
- // else if (this.chkPortraitVersion.Checked)
- // { StrQueryCondition += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.写真订单).ToString() + "'"; }
- // else if (this.chkFw.Checked)
- // { StrQueryCondition += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.服务订单).ToString() + "'"; }
- // else if (this.chkHQ.Checked)
- // { StrQueryCondition += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.婚庆订单).ToString() + "'"; }
- // if (this.DictData.ContainsKey("OrdersPerson") && this.DictData["OrdersPerson"].ToString().Trim().Length > 0)
- // { StrQueryCondition += " And Ord_OrderPersonName like '%" + this.DictData["OrdersPerson"].ToString().Trim() + "%'"; }
- // if (this.DictData.ContainsKey("CustomerSource") && this.DictData["CustomerSource"].ToString().Trim().Length > 0)
- // { StrQueryCondition += " And Ord_CustomerSource like '%" + this.DictData["CustomerSource"].ToString().Trim() + "%'"; }
- // #region 订单查询时间;
- // if ( this.DictData.ContainsKey("QueryDateTimeStart") && this.DictData.ContainsKey("QueryDateTimeEnd") )
- // {
- // StrQueryCondition += " And (Ord_CreateDatetime >= '" + this.DictData["QueryDateTimeStart"].ToString() + "' and Ord_CreateDatetime <= '" + this.DictData["QueryDateTimeEnd"].ToString() + "')";
- // }
- // #endregion
- // }
- //}
- int intTopCount = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPageSize();
- Hashtable htData = LYFZ.ComponentLibrary.DataGridOrderView.GetData_OrderPayment(this.dgvData, dictColumns, StrQueryCondition, intTopCount,
- this.StrSortField, ucPagerEx1.PageCurrent);
- this.dataGridViewStatisticsCount1.LocationX = this.dgvData.RowHeadersWidth;
- this.dataGridViewStatisticsCount1.CurrenQuantity = Convert.ToInt32(htData["CurrentCount"].ToString());
- this.dataGridViewStatisticsCount1.TotalQuantity = Convert.ToInt32(htData["TotalCount"].ToString());
- BindPageData(ucPagerEx1.PageCurrent, Convert.ToInt32(htData["CurrentCount"]), Convert.ToInt32(htData["TotalCount"]));
- }
- string StrWhere()
- {
- string StrQueryCondition = "";
- if (IsFirstRun && !string.IsNullOrEmpty(LYFZ.BLL.BLL_ErpOrder.CurrentSelectedOrderNumber))
- {
- string StrWhere = " And Ord_SinceOrderNumber = '" + LYFZ.BLL.BLL_ErpOrder.CurrentSelectedOrderNumber + "'";
- this.cmbQueryText.Text = LYFZ.BLL.BLL_ErpOrder.CurrentSelectedOrderNumber;
- StrQueryCondition = StrWhere + LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupQueryOrderClickWhere(this.cmbtreevStoreName, "Ord_DividedShop");
- }
- else
- {
- StrQueryCondition = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupQueryWhere(this.cmbtreevStoreName, "Ord_DividedShop");
- if (this.cmbQueryText.Text.Trim().Length > 0)
- { StrQueryCondition += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetQueryTextQueryCondition(this.cmbQueryText.Text.Trim()); }
- else
- {
- if (this.chkQJ.Checked)
- {
- //StrQueryCondition += " And ((select Count(ID) from tb_ErpOrderDigitalStatus where Ords_OrdNumber = Ord_Number) * 2 = (select Sum(Ords_ProductPickupIntStatus) from tb_ErpOrderDigitalStatus where Ords_OrdNumber = Ord_Number))";
- StrQueryCondition += " And asOrderPickupAndServiceStatus.Ords_ProductPickupStatus = 2 ";
- }
- else
- {
- //StrQueryCondition += " And ((select Count(ID) from tb_ErpOrderDigitalStatus where Ords_OrdNumber = Ord_Number) * 2 != (select Sum(Ords_ProductPickupIntStatus) from tb_ErpOrderDigitalStatus where Ords_OrdNumber = Ord_Number))";
- StrQueryCondition += " And asOrderPickupAndServiceStatus.Ords_ProductPickupStatus != 2 ";
- }
- if (this.chkArrears.Checked)
- { StrQueryCondition += " And (套系金额 + isnull(加挑金额, 0) - isnull(收款金额, 0)) > 0"; }
- if (this.chkDressVersion.Checked)
- { StrQueryCondition += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.婚纱订单).ToString() + "'"; }
- else if (this.chkKidsVersion.Checked)
- { StrQueryCondition += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.儿童订单).ToString() + "'"; }
- else if (this.chkPortraitVersion.Checked)
- { StrQueryCondition += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.写真订单).ToString() + "'"; }
- else if (this.chkFw.Checked)
- { StrQueryCondition += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.服务订单).ToString() + "'"; }
- else if (this.chkHQ.Checked)
- { StrQueryCondition += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.婚庆订单).ToString() + "'"; }
- if (this.DictData.ContainsKey("OrdersPerson") && this.DictData["OrdersPerson"].ToString().Trim().Length > 0)
- { StrQueryCondition += " And Ord_OrderPersonName like '%" + this.DictData["OrdersPerson"].ToString().Trim() + "%'"; }
- if (this.DictData.ContainsKey("CustomerSource") && this.DictData["CustomerSource"].ToString().Trim().Length > 0)
- { StrQueryCondition += " And Ord_CustomerSource like '%" + this.DictData["CustomerSource"].ToString().Trim() + "%'"; }
- #region 订单查询时间;
- if (this.DictData.ContainsKey("QueryDateTimeStart") && this.DictData.ContainsKey("QueryDateTimeEnd"))
- {
- StrQueryCondition += " And (Ordv_CreateDatetime between '" + this.DictData["QueryDateTimeStart"].ToString() + "' and '" + this.DictData["QueryDateTimeEnd"].ToString() + "')";
- }
- #endregion
- }
- }
- return StrQueryCondition;
- }
- }
- }
|