123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366 |
- using LYFZ.ComponentLibrary;
- using LYFZ.Software.MainBusiness.DoorCityProcess;
- 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 FrmPieceCommissionRecords : LYFZ.Software.UI.FinancialManagement.FrmPieceCommissionRecords
- {
- List<LYFZ.Software.MainBusiness.EnumPermissions.BusinessType> Versions = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessTypeList();
- public FrmPieceCommissionRecords()
- {
- this.Shown += FrmPieceCommissionRecords_Shown;
- this.txtkeyword.KeyDown += txtkeyword_KeyDown;
- this.btnQuery.Click += btnQuery_Click;
- this.btnConditionQuery.Click += btnConditionQuery_Click;
- this.btnEntry.Click += btnEntry_Click;
- this.btnDelete.Click += btnDelete_Click;
- this.btnClose.Click += btnClose_Click;
- this.chkDress.Click += chkDress_Click;
- this.chkChild.Click += chkChild_Click;
- this.chkPortrait.Click += chkPortrait_Click;
- this.chkService.Click += chkService_Click;
- this.chkWeddingCelebration.Click += chkWeddingCelebration_Click;
- this.Resize += FrmPieceCommissionRecords_Resize;
- // 导出按钮;
- this.btnExport.Click += BtnExport_Click;
- }
- /// <summary>
- /// 导出按钮 ;
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnExport_Click(object sender, EventArgs e)
- {
- if (this.dgvData.Rows.Count == 0)
- {
- MessageBox.Show("没有数据可以导出");
- return;
- }
- this.dgvData.ExportDataTable();
- }
- Hashtable htData = new Hashtable();
- /// <summary>
- /// 加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void FrmPieceCommissionRecords_Shown(object sender, EventArgs e)
- {
- this.dtpDateTimeStart.DateValue = SDateTime.Now.ToString("yyyy-MM-dd");
- this.dtpDateTimeEnd.DateValue = this.dtpDateTimeStart.DateValue;
- this.chkChild.Visible = false;
- this.chkPortrait.Visible = false;
- this.chkDress.Visible = false;
- for (int i = 0; i < this.Versions.Count; i++)
- {
- LYFZ.Software.MainBusiness.EnumPermissions.BusinessType Version = Versions[i];
- if (Version.ToString() == EnumPermissions.BusinessType.写真版.ToString())
- { this.chkPortrait.Visible = true; }
- if (Version.ToString() == EnumPermissions.BusinessType.婚纱版.ToString())
- { this.chkDress.Visible = true; }
- if (Version.ToString() == EnumPermissions.BusinessType.儿童版.ToString())
- { this.chkChild.Visible = true; }
- }
- this.PublicFunctionRows();
- // 权限设置
- this.btnEntry.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.PieceCommissionRecordsCompetence, CustomAttributes.OperatingAuthority.Add);
- this.btnDelete.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.PieceCommissionRecordsCompetence, CustomAttributes.OperatingAuthority.Delete);
- }
- /// <summary>
- /// 回车查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtkeyword_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- { 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)
- {
- LYFZ.Software.MainBusiness.FinancialManagement.SetSmallForm.ConditionQueryPieceCommissionSetSmallForm frm = new SetSmallForm.ConditionQueryPieceCommissionSetSmallForm();
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- this.htData = frm.htData;
- this.PublicFunctionRows();
- }
- }
- /// <summary>
- /// 录入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnEntry_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.FinancialManagement.PieceCommissionRecords.FrmWeddingEntry frm = new MainBusiness.FinancialManagement.PieceCommissionRecords.FrmWeddingEntry();
- if (frm.ShowDialog() == DialogResult.OK)
- { this.PublicFunctionRows(); }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDelete_Click(object sender, EventArgs e)
- {
- if (this.dgvData.SelectedRows.Count == 0)
- { MessageBoxCustom.Show("请选中你要删除的数据!"); return; }
- if (MessageBoxCustom.Show("你确定要删除吗?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- LYFZ.BLL.BLL_ErpPieceCommissionRecords bll = new BLL.BLL_ErpPieceCommissionRecords();
- int id = Convert.ToInt32(this.dgvData.CurrentRow.Cells["ID"].Value);
- if (bll.Delete(id) == true)
- {
- string logsContent = "删除计件提成订单号为:" + this.dgvData.CurrentRow.Cells["订单号"].Value.ToString() + " 完成内容:" + this.dgvData.CurrentRow.Cells["工作内容"].Value.ToString();
- LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(LYFZ.EnumPublic.SystemLogsType.删除计件提成, logsContent, LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name);
- MessageBoxCustom.Show("删除成功!");
- PublicFunctionRows();
- }
- else
- { MessageBoxCustom.Show("删除失败!"); }
- }
- }
- /// <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 chkDress_Click(object sender, EventArgs e)
- {
- this.chkChild.Checked = false;
- this.chkService.Checked = false;
- this.chkPortrait.Checked = false;
- this.chkWeddingCelebration.Checked = false;
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 儿童
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkChild_Click(object sender, EventArgs e)
- {
- this.chkDress.Checked = false;
- this.chkService.Checked = false;
- this.chkPortrait.Checked = false;
- this.chkWeddingCelebration.Checked = false;
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 写真
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkPortrait_Click(object sender, EventArgs e)
- {
- this.chkDress.Checked = false;
- this.chkChild.Checked = false;
- this.chkService.Checked = false;
- this.chkWeddingCelebration.Checked = false;
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 服务
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkService_Click(object sender, EventArgs e)
- {
- this.chkDress.Checked = false;
- this.chkChild.Checked = false;
- this.chkPortrait.Checked = false;
- this.chkWeddingCelebration.Checked = false;
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 婚庆
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkWeddingCelebration_Click(object sender, EventArgs e)
- {
- this.chkService.Checked = false;
- this.chkDress.Checked = false;
- this.chkChild.Checked = false;
- this.chkPortrait.Checked = false;
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 窗体大小发生变化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void FrmPieceCommissionRecords_Resize(object sender, EventArgs e)
- {
- switch (this.panelWeddingCelebration.Location.Y)
- {
- case 5: this.flowLayoutPanel1.Height = 40; break;
- case 39: this.flowLayoutPanel1.Height = 70; break;
- }
- }
- /// <summary>
- /// 绑定数据
- /// </summary>
- public void PublicFunctionRows()
- {
- DataTable newTable = new DataTable();
- string StrWhere = " Where 1 = 1 ";
- //if (!string.IsNullOrEmpty(this.dtpDateTimeStart.DateValue) && !string.IsNullOrEmpty(this.dtpDateTimeEnd.DateValue))
- //{ StrWhere += PublicCodeClasses.GetDateTime("Pcr_Date", this.dtpDateTimeStart.DateValue, this.dtpDateTimeEnd.DateValue); }
- if (this.chkDress.Checked)
- {
- StrWhere += " and 订单类型 = '0'";
- }
- else if (this.chkChild.Checked)
- {
- StrWhere += " and 订单类型 = '1'";
- }
- else if (this.chkPortrait.Checked)
- {
- StrWhere += " and 订单类型 = '2'";
- }
- else if (this.chkService.Checked)
- {
- StrWhere += " and 订单类型 = '3'";
- }
- else if (this.chkWeddingCelebration.Checked)
- {
- StrWhere += " and 订单类型 = '4'";
- }
- if (!string.IsNullOrEmpty(this.txtkeyword.Text.Trim()))
- { StrWhere += " and (客户姓名 like '%" + this.txtkeyword.Text.Trim() + "%' or Cus_Name_py like '%" + this.txtkeyword.Text.Trim() + "%' or 客户电话 like '%" + this.txtkeyword.Text.Trim() + "%')"; }
- if (this.htData.Count > 0)
- {
- if (htData.ContainsKey("CommissionName"))
- { StrWhere += " and 提成人 = '" + htData["CommissionName"].ToString().Trim() + "'"; }
- if (htData.ContainsKey("SeriesName"))
- { StrWhere += " and 套系名称 = '" + htData["SeriesName"].ToString().Trim() + "'"; }
- if (htData.ContainsKey("WorkContent"))
- { StrWhere += " and Pcr_CompletionContents = '" + htData["WorkContent"].ToString().Trim() + "'"; }
- }
- this.htData.Clear();
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- newTable = LYFZ.BLL.BLL_ErpOrderView.GetData_FinancialManagementPieceStatistics(StrWhere
- , this.dtpDateTimeStart.Value.ToString("yyyy-MM-dd")
- , this.dtpDateTimeEnd.Value.ToString("yyyy-MM-dd"));
- });
- #region
- this.dgvData.DataColumns(newTable.Columns, strHideField: "ID");
- this.dgvData.Columns["工作内容"].Width = 250;
- this.dgvData.Columns["提成日期"].Width = 120;
- this.dgvData.Columns["录入日期"].Width = 120;
- this.dgvData.Columns["套系名称"].Width = 150;
- this.dgvData.FillLastColumn();
- for (int t = 0; t < newTable.Rows.Count; t++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewCell cell = null;
- cell = new DataGridViewTextBoxCell();
- cell.Value = newTable.Rows[t]["ID"].ToString().Trim(); ;
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = newTable.Rows[t]["工作内容"].ToString();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = newTable.Rows[t]["工作数量"];
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = newTable.Rows[t]["导片数量"];
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName(newTable.Rows[t]["提成人"]);
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = LYFZ.BLL.OtherCommonModel.DateTimeToString(newTable.Rows[t]["提成日期"]);
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = newTable.Rows[t]["订单号"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- if (newTable.Rows[t]["订单类型"].ToString().Trim().Length > 0&& newTable.Rows[t]["订单类型"].ToString()!= "散客消费")
- {
- cell.Value = Enum.ToObject(typeof(LYFZ.EnumPublic.OrderType), Convert.ToInt32(newTable.Rows[t]["订单类型"])).ToString();
- }
- else
- {
- cell.Value = "散客消费";
- }
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = newTable.Rows[t]["客户姓名"];
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = newTable.Rows[t]["客户电话"];
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = newTable.Rows[t]["套系名称"];
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = newTable.Rows[t]["套系价格"];
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName(newTable.Rows[t]["录单人"]);
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = LYFZ.BLL.OtherCommonModel.DateTimeToString(newTable.Rows[t]["录入日期"]);
- dgvr.Cells.Add(cell);
-
- this.dgvData.Rows.Add(dgvr);
- }
- #endregion
- this.dgvData.ClearSelection();
- }
- }
- }
|