using LYFZ.ComponentLibrary;
using System;
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.StatisticalInquiry
{
public partial class FrmStatisticalInquiryPayroll : LYFZ.Software.UI.StatisticalInquiry.FrmStatisticalInquiryPayroll
{
public FrmStatisticalInquiryPayroll()
{
}
public string User_EmployeeID = "";
public string TimeStart = "";
public string TimeEnd = "";
decimal Piece = 0; //计件提成
#region 加载
protected override void FrmStatisticalInquiryPayroll_Shown(object sender, EventArgs e)
{
WaitForm wf = new WaitForm();
wf.ShowForm(this);
try
{
#region 部门人员绑定
LYFZ.BLL.BLL_ErpDepartment BLLerpdepartment = new BLL.BLL_ErpDepartment();
DataTable tbl = BLLerpdepartment.GetAllList().Tables[0];
if (tbl.Rows.Count > 0)
{
TreeNode root = null;
for (int i = 0; i < tbl.Rows.Count; i++)
{
root = new TreeNode(tbl.Rows[i]["Dt_Name"].ToString());
this.CreateTreeViewDepartmentUser(root.Nodes, tbl.Rows[i]["ID"].ToString());
this.txtTsorder_OpenSingle.TreeView.Nodes.Add(root);
}
}
#endregion
if (!string.IsNullOrEmpty(User_EmployeeID))
{
dgv1.Rows.Clear();
dgv2.Rows.Clear();
dgv3.Rows.Clear();
dgv4.Rows.Clear();
txtWs_BasicWage.Text = "";
txtEarlyResults.Text = "";
txtTwoPinsResults.Text = "";
txtPieceCommission.Text = "";
txtTotalWages.Text = "";
txtTsorder_OpenSingle.TagFindText("");
txtTsorder_OpenSingle.TagFindText(User_EmployeeID);
txtTimeStart.Text = TimeStart;
txtTimeEnd.Text = TimeEnd;
LYFZ.BLL.BLL_ErpWagesSet wagesBll = new BLL.BLL_ErpWagesSet();
#region 获取人员基本信息
DataTable wagesdt = wagesBll.GetList("Ws_StaffCode='" + txtTsorder_OpenSingle.Tag.ToString() + "'").Tables[0];
if (wagesdt.Rows.Count > 0)
{
txtWs_Remark.Text = wagesdt.Rows[0]["Ws_Remark"].ToString();
txtWs_BasicWage.Text = wagesdt.Rows[0]["Ws_BasicWage"].ToString();
}
else
{
txtWs_Remark.Text = "";
txtWs_BasicWage.Text = "0.00";
}
#endregion
#region 获取列表
//订单,二销提成数据源绑定
BindSalarylist(txtTsorder_OpenSingle.Tag.ToString(), Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
//摄影与助理数据源绑定
PhotographyBind();
//修片与精修与设计
BindPhoto();
//计件提成
BindPiece(txtTsorder_OpenSingle.Tag.ToString(), Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
#endregion
#region 获取工资
GetWages(txtTsorder_OpenSingle.Tag.ToString());
#endregion
#region 自动统计
BindAutomaticStatistics(txtTsorder_OpenSingle.Tag.ToString(), Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
#endregion
}
else
{
txtTimeStart.Text = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().AddDays(1 - LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().Day)).ToString("yyyy-MM-dd");
txtTimeEnd.Text = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime()).AddDays(1 - LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().Day).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd");
}
wf.CloseForm();
wf = null;
return;
}
catch
{
wf.CloseForm();
wf = null;
}
}
#endregion
#region 选择人员事件
protected override void txtTsorder_OpenSingle_ComboBoxTreeViewEx_TextChanged(object sender, EventArgs e)
{
WaitForm wf = new WaitForm();
wf.ShowForm(this);
try
{
dgv1.Rows.Clear();
dgv2.Rows.Clear();
dgv3.Rows.Clear();
dgv4.Rows.Clear();
txtWs_BasicWage.Text = "";
txtEarlyResults.Text = "";
txtTwoPinsResults.Text = "";
txtPieceCommission.Text = "";
txtTotalWages.Text = "";
if (string.IsNullOrEmpty(txtTimeStart.Text) || string.IsNullOrEmpty(txtTimeEnd.Text))
{
MessageBoxCustom.Show("请输入时间!");
return;
}
txtTsorder_OpenSingle.TextFindTag(txtTsorder_OpenSingle.Text.ToString());
LYFZ.BLL.BLL_ErpWagesSet wagesBll = new BLL.BLL_ErpWagesSet();
#region 获取人员基本信息
DataTable wagesdt = wagesBll.GetList("Ws_StaffCode='" + txtTsorder_OpenSingle.Tag.ToString() + "'").Tables[0];
if (wagesdt.Rows.Count > 0)
{
txtWs_Remark.Text = wagesdt.Rows[0]["Ws_Remark"].ToString();
txtWs_BasicWage.Text = wagesdt.Rows[0]["Ws_BasicWage"].ToString();
}
else
{
txtWs_Remark.Text = "";
txtWs_BasicWage.Text = "0.00";
}
#endregion
#region 获取列表
//订单,二销提成数据源绑定
BindSalarylist(txtTsorder_OpenSingle.Tag.ToString(), Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
//摄影与助理数据源绑定
PhotographyBind();
//修片与精修与设计
BindPhoto();
//计件提成
BindPiece(txtTsorder_OpenSingle.Tag.ToString(), Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
#endregion
#region 获取工资
GetWages(txtTsorder_OpenSingle.Tag.ToString());
#endregion
#region 自动统计
BindAutomaticStatistics(txtTsorder_OpenSingle.Tag.ToString(), Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
#endregion
wf.CloseForm();
wf = null;
}
catch
{
wf.CloseForm();
wf = null;
}
}
#region 订单,二销提成数据源绑定
///
/// 订单,二销提成数据源绑定
///
///
///
///
public void BindSalarylist(string Tsorder_OpenSingle, string TimeStart, string TimeEnd)
{
try
{
LYFZ.BLL.BLL_ErpSystemConfigure SystemConfigureBll = new BLL.BLL_ErpSystemConfigure(); ;
LYFZ.BLL.BLL_ErpWagesSet WagesSetBll = new BLL.BLL_ErpWagesSet();
LYFZ.BLL.BLL_ErpOrdersPhotography OrdersPhotographyBll = new BLL.BLL_ErpOrdersPhotography();
DataTable dt = new DataTable();
StringBuilder sql = new StringBuilder();
#region 查询人员是否有订单收款记录(前期,二销,其它消费)
// or Ordpg_PhotographerId like '%" + Tsorder_OpenSingle + "%' or Ordpg_PhotographyAssistantId like '%" + Tsorder_OpenSingle + "%' or Ordpg_MakeupArtistId like '%" + Tsorder_OpenSingle + "%' or Ordpg_MakeupAssistantId like '%" + Tsorder_OpenSingle + "%' or Ordpg_BootDivisionId like '%" + Tsorder_OpenSingle + "%'
sql.Append(" and (Pay_OpenSingle like '%" + Tsorder_OpenSingle + "%')");
sql.Append(" and (Pay_CreateDatetime>='" + TimeStart + "' and Pay_CreateDatetime<='" + TimeEnd + " 23:59:59.000')");
dt = WagesSetBll.Vw_OrdersWagePaymentRecords(sql.ToString()).Tables[0];
if (dt.Rows.Count > 0)
{
//显示人员订单全部收款记录
for (int t = 0; t < dt.Rows.Count; t++)
{
#region 获取订单 前期收款与后期收款 记录
DataGridViewRow dgvr = new DataGridViewRow();
DataGridViewCell cell = null;
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "3" ? "服务订单" : "其它消费";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
if (dt.Rows[t]["Pay_Category"].ToString().Trim() == "后期收款")
{
cell.Value = dt.Rows[t]["Pay_TwoPinsCategoryName"].ToString().Trim();
}
else
{
cell.Value = "前期收款";
}
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
if (string.IsNullOrEmpty(dt.Rows[t]["Ord_CustomerName1"].ToString().Trim()))
{
LYFZ.BLL.BLL_ErpTwoSalesOrder TwoSalesOrderbll = new BLL.BLL_ErpTwoSalesOrder();
DataTable TwoSalesOrderdt = TwoSalesOrderbll.GetView_TwoSalesOrder(" Tsorder_Number='" + dt.Rows[t]["Pay_OrdNumber"].ToString().Trim() + "'").Tables[0];
if (TwoSalesOrderdt.Rows.Count > 0)
{
cell.Value = TwoSalesOrderdt.Rows[0]["Tsorder_CustomerName"].ToString();
}
else { cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim(); }
}
else { cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim(); }
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
dgvr.Cells.Add(cell);
//门市类型
cell = new DataGridViewTextBoxCell();
LYFZ.BLL.BLL_ErpOrdersPerson OrdersPersonbll = new BLL.BLL_ErpOrdersPerson();
DataTable OrdersPersondt = OrdersPersonbll.GetList(" OrdPe_OrderNumber='" + dt.Rows[t]["Pay_OrdNumber"].ToString() + "' and OrdPe_OrdersPerson='" + txtTsorder_OpenSingle.Tag.ToString() + "'").Tables[0];
if (OrdersPersondt.Rows.Count > 0)
{
if (dt.Rows[t]["Pay_Category"].ToString().Trim() != "后期收款")
{
cell.Value = OrdersPersondt.Rows[0]["OrdPe_Type"];
}
}
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
this.dgv1.Rows.Add(dgvr);
#endregion
dgv1.ClearSelection();
}
}
#endregion
#region 婚纱版/写真版 检测是否有化妆/摄影工作前期/与二销后期
#region 摄影
dt = new DataTable();
sql = new StringBuilder();
sql.Append(" (Ordpg_PhotographerId like '%" + Tsorder_OpenSingle + "%' or Ordpg_PhotographyAssistantId like '%" + Tsorder_OpenSingle + "%') and OrdPg_PhotographyStatus='ok' ");
sql.Append(" and (OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + " 23:59:59.000')");
dt = WagesSetBll.View_OrdersWagePaymentRecords_Wedding(sql.ToString()).Tables[0];
if (dt.Rows.Count > 0)
{
for (int t = 0; t < dt.Rows.Count; t++)
{
#region 摄影
if ((dt.Rows[t]["Pay_Category"].ToString().Trim() != "后期收款"))
{
#region 摄影师也有前期提成(无二销)
DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='PhotographerEarlyPinsPercentage'").Tables[0];
if (dtSystemConfigure.Rows.Count > 0)
{
if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
{
DataGridViewRow dgvr = new DataGridViewRow();
DataGridViewCell cell = null;
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "摄影前期";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
this.dgv1.Rows.Add(dgvr);
dgv1.ClearSelection();
}
}
#endregion
}
if ((dt.Rows[t]["Pay_TwoPinsCategoryName"].ToString().Trim() == "选片二销"))
{
#region 摄影师也有选片二销提成
DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='PhotographerTwoPinsPercentage'").Tables[0];
if (dtSystemConfigure.Rows.Count > 0)
{
if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
{
DataGridViewRow dgvr = new DataGridViewRow();
DataGridViewCell cell = null;
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "摄影选片二销";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
this.dgv1.Rows.Add(dgvr);
dgv1.ClearSelection();
}
}
#endregion
}
#endregion
}
}
#endregion
#region 化妆
dt = new DataTable();
sql = new StringBuilder();
sql.Append(" (Ordpg_MakeupArtistId like '%" + Tsorder_OpenSingle + "%' or Ordpg_MakeupAssistantId like '%" + Tsorder_OpenSingle + "%') and OrdPg_PhotographyStatus='ok' ");
sql.Append(" and (OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + " 23:59:59.000')");
dt = WagesSetBll.View_OrdersWagePaymentRecords_Wedding(sql.ToString()).Tables[0];
if (dt.Rows.Count > 0)
{
for (int t = 0; t < dt.Rows.Count; t++)
{
#region 化妆
if ((dt.Rows[t]["Pay_Category"].ToString().Trim() != "后期收款"))
{
#region 化妆师也有前期提成(无二销)
DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='MakeupEarlyPinsPercentage'").Tables[0];
if (dtSystemConfigure.Rows.Count > 0)
{
if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
{
DataGridViewRow dgvr = new DataGridViewRow();
DataGridViewCell cell = null;
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "化妆前期";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
this.dgv1.Rows.Add(dgvr);
dgv1.ClearSelection();
}
}
#endregion
}
if ((dt.Rows[t]["Pay_TwoPinsCategoryName"].ToString().Trim() == "选片二销"))
{
#region 化妆师也有选片二销提成
DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='MakeupTwoPinsPercentage'").Tables[0];
if (dtSystemConfigure.Rows.Count > 0)
{
if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
{
DataGridViewRow dgvr = new DataGridViewRow();
DataGridViewCell cell = null;
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "化妆选片二销";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
this.dgv1.Rows.Add(dgvr);
dgv1.ClearSelection();
}
}
#endregion
}
#endregion
}
}
#endregion
#endregion
#region 儿童版 检测是否有化妆/摄影/引导工作前期/与二销后期
#region 摄影
dt = new DataTable();
sql = new StringBuilder();
sql.Append(" (Ordpg_Photographer like '%" + Tsorder_OpenSingle + "%' or Ordpg_PhotographyAssistant like '%" + Tsorder_OpenSingle + "%') ");
sql.Append(" and (OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + " 23:59:59.000')");
dt = WagesSetBll.View_OrdersWagePaymentRecords_Child(sql.ToString()).Tables[0];
if (dt.Rows.Count > 0)
{
for (int t = 0; t < dt.Rows.Count; t++)
{
#region 摄影
if ((dt.Rows[t]["Pay_Category"].ToString().Trim() != "后期收款"))
{
#region 摄影师也有前期提成(无二销)
DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='PhotographerEarlyPinsPercentage'").Tables[0];
if (dtSystemConfigure.Rows.Count > 0)
{
if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
{
DataGridViewRow dgvr = new DataGridViewRow();
DataGridViewCell cell = null;
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = (dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单") + "(" + (dt.Rows[t]["Ordpg_Sights"].ToString().Trim()) + ")";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "摄影前期";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
this.dgv1.Rows.Add(dgvr);
dgv1.ClearSelection();
}
}
#endregion
}
if ((dt.Rows[t]["Pay_TwoPinsCategoryName"].ToString().Trim() == "选片二销"))
{
#region 摄影师也有选片二销提成
DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='PhotographerTwoPinsPercentage'").Tables[0];
if (dtSystemConfigure.Rows.Count > 0)
{
if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
{
DataGridViewRow dgvr = new DataGridViewRow();
DataGridViewCell cell = null;
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = (dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单") + "(" + (dt.Rows[t]["Ordpg_Sights"].ToString().Trim()) + ")";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "摄影选片二销";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
this.dgv1.Rows.Add(dgvr);
dgv1.ClearSelection();
}
}
#endregion
}
#endregion
}
}
#endregion
#region 化妆
dt = new DataTable();
sql = new StringBuilder();
sql.Append(" (Ordpg_MakeupArtist like '%" + Tsorder_OpenSingle + "%' or Ordpg_MakeupAssistant like '%" + Tsorder_OpenSingle + "%') ");
sql.Append(" and (OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + " 23:59:59.000')");
dt = WagesSetBll.View_OrdersWagePaymentRecords_Child(sql.ToString()).Tables[0];
if (dt.Rows.Count > 0)
{
for (int t = 0; t < dt.Rows.Count; t++)
{
#region 化妆
if ((dt.Rows[t]["Pay_Category"].ToString().Trim() != "后期收款"))
{
#region 化妆师也有前期提成(无二销)
DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='MakeupEarlyPinsPercentage'").Tables[0];
if (dtSystemConfigure.Rows.Count > 0)
{
if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
{
DataGridViewRow dgvr = new DataGridViewRow();
DataGridViewCell cell = null;
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = (dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单") + "(" + (dt.Rows[t]["Ordpg_Sights"].ToString().Trim()) + ")";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "化妆前期";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
this.dgv1.Rows.Add(dgvr);
dgv1.ClearSelection();
}
}
#endregion
}
if ((dt.Rows[t]["Pay_TwoPinsCategoryName"].ToString().Trim() == "选片二销"))
{
#region 化妆师也有选片二销提成
DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='MakeupTwoPinsPercentage'").Tables[0];
if (dtSystemConfigure.Rows.Count > 0)
{
if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
{
DataGridViewRow dgvr = new DataGridViewRow();
DataGridViewCell cell = null;
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = (dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单") + "(" + (dt.Rows[t]["Ordpg_Sights"].ToString().Trim()) + ")";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "化妆选片二销";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
this.dgv1.Rows.Add(dgvr);
dgv1.ClearSelection();
}
}
#endregion
}
#endregion
}
}
#endregion
#region 引导
dt = new DataTable();
sql = new StringBuilder();
sql.Append(" Ordpg_BootDivision like '%" + Tsorder_OpenSingle + "%' ");
sql.Append(" and (OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + " 23:59:59.000')");
dt = WagesSetBll.View_OrdersWagePaymentRecords_Child(sql.ToString()).Tables[0];
if (dt.Rows.Count > 0)
{
for (int t = 0; t < dt.Rows.Count; t++)
{
#region 引导
if ((dt.Rows[t]["Pay_Category"].ToString().Trim() != "后期收款"))
{
#region 引导师也有前期提成(无二销)
DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='MakeupEarlyPinsPercentage'").Tables[0];
if (dtSystemConfigure.Rows.Count > 0)
{
if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
{
DataGridViewRow dgvr = new DataGridViewRow();
DataGridViewCell cell = null;
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = (dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单") + "(" + (dt.Rows[t]["Ordpg_Sights"].ToString().Trim()) + ")";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "引导前期";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
this.dgv1.Rows.Add(dgvr);
dgv1.ClearSelection();
}
}
#endregion
}
if ((dt.Rows[t]["Pay_TwoPinsCategoryName"].ToString().Trim() == "选片二销"))
{
#region 引导师也有选片二销提成
DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='MakeupTwoPinsPercentage'").Tables[0];
if (dtSystemConfigure.Rows.Count > 0)
{
if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
{
DataGridViewRow dgvr = new DataGridViewRow();
DataGridViewCell cell = null;
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = (dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单") + "(" + (dt.Rows[t]["Ordpg_Sights"].ToString().Trim()) + ")";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "引导选片二销";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = "";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
this.dgv1.Rows.Add(dgvr);
dgv1.ClearSelection();
}
}
#endregion
}
#endregion
}
}
#endregion
#endregion
}
catch (Exception ex)
{
MessageBoxCustom.Show(ex.Message);
}
}
#endregion
#region 摄影与助理数据源绑定
public void PhotographyBind()
{
try
{
dgv2.Rows.Clear();
LYFZ.BLL.BLL_ErpWagesSet WagesSetBll = new BLL.BLL_ErpWagesSet();
DataTable dt = new DataTable();
StringBuilder sql = new StringBuilder();
sql.Append(" (OrdPg_Photographer like '%" + txtTsorder_OpenSingle.Tag.ToString() + "%' or OrdPg_PhotographyAssistant like '%" + txtTsorder_OpenSingle.Tag.ToString() + "%' or OrdPg_MakeupArtist like '%" + txtTsorder_OpenSingle.Tag.ToString() + "%' or OrdPg_MakeupAssistant like '%" + txtTsorder_OpenSingle.Tag.ToString() + "%' or OrdPg_BootDivision like '%" + txtTsorder_OpenSingle.Tag.ToString() + "%')");
sql.Append(" and (OrdPg_PhotographyTime>='" + Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd") + "' and OrdPg_PhotographyTime<='" + Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd") + "' and OrdPg_PhotographyStatus='1' and Ord_Class='1')");
dt = WagesSetBll.Vw_OrdersWagePhotography(sql.ToString()).Tables[0];
if (dt.Rows.Count > 0)
{
for (int t = 0; t < dt.Rows.Count; t++)
{
#region
DataGridViewRow dgvr = new DataGridViewRow();
DataGridViewCell cell = null;
//订单号
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ordpg_Number"].ToString().Trim();
dgvr.Cells.Add(cell);
//订单类型
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单";
dgvr.Cells.Add(cell);
//客户1
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString();
dgvr.Cells.Add(cell);
//客户2
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString();
dgvr.Cells.Add(cell);
//套系
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString();
dgvr.Cells.Add(cell);
//套系价格
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_SeriesPrice"].ToString().Trim();
dgvr.Cells.Add(cell);
//景点
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["OrdPg_Sights"].ToString().Trim();
dgvr.Cells.Add(cell);
//景点级别
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Sc_ClassName"].ToString().Trim();
dgvr.Cells.Add(cell);
//日期
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDateTime(dt.Rows[t]["OrdPg_PhotographyTime"]).ToString("yyyy-MM-dd");
dgvr.Cells.Add(cell);
//状态
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["OrdPg_PhotographyStatusName"].ToString();
dgvr.Cells.Add(cell);
//摄影
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["OrdPg_PhotographerName"].ToString().Trim();
dgvr.Cells.Add(cell);
//摄影助理
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["OrdPg_PhotographyAssistantName"].ToString().Trim();
dgvr.Cells.Add(cell);
//化妆
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["OrdPg_MakeupArtistName"].ToString().Trim();
dgvr.Cells.Add(cell);
//化妆助理
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["OrdPg_MakeupAssistantName"].ToString().Trim();
dgvr.Cells.Add(cell);
//引导师
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["OrdPg_BootDivisionName"].ToString().Trim();
dgvr.Cells.Add(cell);
//套系类别
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_PhotographyCategory"].ToString().Trim();
dgvr.Cells.Add(cell);
this.dgv2.Rows.Add(dgvr);
dgv2.ClearSelection();
#endregion
}
}
}
catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
}
#endregion
#region 修片与精修与设计
public void BindPhoto()
{
try
{ //Ord_ClothingNameID='" + txtTsorder_OpenSingle.Tag.ToString() + "' or(Ord_ClothingTime>='" + txtTimeStart.Text + "' and Ord_ClothingTime<='" + txtTimeEnd.Text + " 23:59:59.000') or
dgv3.Rows.Clear();
LYFZ.BLL.BLL_ErpWagesSet wagesBll = new BLL.BLL_ErpWagesSet();
DataTable dt = new DataTable();
StringBuilder sql = new StringBuilder();
sql.Append(" ( Ordv_EarlyRepairNameID='" + txtTsorder_OpenSingle.Tag.ToString() + "' or Ordv_DesignerNameID='" + txtTsorder_OpenSingle.Tag.ToString() + "' or Ordv_RefinementNameID='" + txtTsorder_OpenSingle.Tag.ToString() + "')");
sql.Append(" and ((Ordv_EarlyRepairTime>='" + Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd") + "' and Ordv_EarlyRepairTime<='" + Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd") + " 23:59:59.000' and Ordv_EarlyRepairStatus='ok') or (Ordv_DesignerTime>='" + Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd") + "' and Ordv_DesignerTime<='" + Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd") + " 23:59:59.000' and Ordv_DesignerStatus='ok') or (Ordv_RefinementTime>='" + Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd") + "' and Ordv_RefinementTime<='" + Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd") + " 23:59:59.000' and Ordv_RefinementStatus='ok'))");
dt = wagesBll.View_OrdersWage(sql.ToString()).Tables[0];
if (dt.Rows.Count > 0)
{
for (int t = 0; t < dt.Rows.Count; t++)
{
#region
DataGridViewRow dgvr = new DataGridViewRow();
DataGridViewCell cell = null;
//订单号
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_Number"].ToString().Trim();
dgvr.Cells.Add(cell);
//订单类型
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单";
dgvr.Cells.Add(cell);
//客户1
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString();
dgvr.Cells.Add(cell);
//客户2
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString();
dgvr.Cells.Add(cell);
//套系
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString();
dgvr.Cells.Add(cell);
//套系价格
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_SeriesPrice"].ToString().Trim();
dgvr.Cells.Add(cell);
//套系类别
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_PhotographyCategory"].ToString().Trim();
dgvr.Cells.Add(cell);
//景点
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["OrdPg_Sights"].ToString().Trim();
dgvr.Cells.Add(cell);
//景点等级
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Sc_ClassName"].ToString().Trim();
dgvr.Cells.Add(cell);
//服装师
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ordv_ClothingName"].ToString();
dgvr.Cells.Add(cell);
//日期1
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ordv_ClothingTime"].ToString().Trim();
dgvr.Cells.Add(cell);
//服装状态
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ordv_ClothingStatus"].ToString().Trim();
dgvr.Cells.Add(cell);
//初修师
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ordv_EarlyRepairName"].ToString().Trim();
dgvr.Cells.Add(cell);
//日期2
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ordv_EarlyRepairTime"].ToString().Trim();
dgvr.Cells.Add(cell);
//初修状态
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ordv_EarlyRepairStatus"].ToString().Trim();
dgvr.Cells.Add(cell);
//精修师
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ordv_RefinementName"].ToString().Trim();
dgvr.Cells.Add(cell);
//日期3
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ordv_RefinementTime"].ToString().Trim();
dgvr.Cells.Add(cell);
//精修状态
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ordv_RefinementStatus"].ToString().Trim();
dgvr.Cells.Add(cell);
//设计师
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ordv_DesignerName"].ToString().Trim();
dgvr.Cells.Add(cell);
//日期4
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ordv_DesignerTime"].ToString().Trim();
dgvr.Cells.Add(cell);
//设计状态
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ordv_DesignerStatus"].ToString().Trim();
dgvr.Cells.Add(cell);
//选片二销
cell = new DataGridViewTextBoxCell();
DataTable dtTwoPie = wagesBll.GetTwoPieSum("Pay_TwoPinsCategoryName='选片二销' and Pay_OrdNumber='" + dt.Rows[t]["Ord_Number"].ToString().Trim() + "'").Tables[0];
cell.Value = dtTwoPie.Rows[0]["Pay_AmountOf"].ToString() == "" ? "0.00" : dtTwoPie.Rows[0]["Pay_AmountOf"].ToString();
dgvr.Cells.Add(cell);
this.dgv3.Rows.Add(dgvr);
dgv3.ClearSelection();
#endregion
}
}
}
catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
}
#endregion
#region 计件提成
public void BindPiece(string Tsorder_OpenSingle, string TimeStart, string TimeEnd)
{
try
{
dgv4.Rows.Clear();
lblPrice.Visible = true;
decimal Price = 0;
LYFZ.BLL.BLL_ErpPieceCommissionRecords PieceCommissionRecordsBll = new BLL.BLL_ErpPieceCommissionRecords();
DataTable dt = new DataTable();
StringBuilder sql = new StringBuilder();
sql.Append(" Pcr_DigitalDivision='" + Tsorder_OpenSingle + "'");
sql.Append(" and (Pcr_Date>='" + TimeStart + "' and Pcr_Date<='" + TimeEnd + " 23:59:59.000')");
dt = PieceCommissionRecordsBll.Vw_ErpPieceCommissionRecords(sql.ToString()).Tables[0];
if (dt.Rows.Count > 0)
{
for (int t = 0; t < dt.Rows.Count; t++)
{
#region
DataGridViewRow dgvr = new DataGridViewRow();
DataGridViewCell cell = null;
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pcr_OrderNumber"].ToString().Trim();
dgvr.Cells.Add(cell);
//订单类型
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单";
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString();
dgvr.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString();
dgvr.Cells.Add(cell);
//提成金额
LYFZ.BLL.BLL_ErpWageCommissionSet WageCommissionSetbll = new BLL.BLL_ErpWageCommissionSet();
DataTable dtWageCommissionSet = WageCommissionSetbll.GetList("Wcs_TypeCode='" + dt.Rows[t]["Pcr_CompletionContents"] + "'").Tables[0];
string Wcs_Percentage = "0";
if (dtWageCommissionSet.Rows.Count > 0)
{
Wcs_Percentage = dtWageCommissionSet.Rows[0]["Wcs_Percentage"].ToString() == "" ? "0" : dtWageCommissionSet.Rows[0]["Wcs_Percentage"].ToString();
}
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDecimal(Convert.ToDecimal(dt.Rows[t]["Pcr_Quantity"]) * Convert.ToDecimal(Wcs_Percentage)).ToString("N2");
dgvr.Cells.Add(cell);
//部门
cell = new DataGridViewTextBoxCell();
cell.Value = "数码师";
dgvr.Cells.Add(cell);
//内容
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pcr_CompletionContentsName"].ToString().Trim();
dgvr.Cells.Add(cell);
//数量
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Pcr_Quantity"].ToString().Trim();
dgvr.Cells.Add(cell);
//单价
cell = new DataGridViewTextBoxCell();
cell.Value = Wcs_Percentage;
dgvr.Cells.Add(cell);
//提成方式
cell = new DataGridViewTextBoxCell();
cell.Value = "单价*数量";
dgvr.Cells.Add(cell);
//套系价格
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ord_SeriesPrice"].ToString().Trim();
dgvr.Cells.Add(cell);
//日期
cell = new DataGridViewTextBoxCell();
cell.Value = Convert.ToDateTime(dt.Rows[t]["Pcr_Date"]).ToString("yyyy-MM-dd");
dgvr.Cells.Add(cell);
//合计总和
decimal ob = Convert.ToDecimal(Convert.ToDecimal(dt.Rows[t]["Pcr_Quantity"]) * Convert.ToDecimal(Wcs_Percentage));
Price += Convert.ToDecimal(ob.ToString("N2"));
this.dgv4.Rows.Add(dgvr);
dgv4.ClearSelection();
#endregion
lblPrice.Text = "(总和:" + Price + ")";
Piece = Price;
}
}
else
{
lblPrice.Text = "(总和:0.00)";
Piece = 0.00m;
}
}
catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
}
#endregion
#endregion
#region 绑定第二级人员
///
/// 绑定第二级人员
///
/// TreeView的节点集合
/// 数据源
///
private void CreateTreeViewDepartmentUser(TreeNodeCollection nodes, string ClassCode)
{
if (ClassCode != "")
{
LYFZ.BLL.BLL_ErpUser BLLerpuser = new BLL.BLL_ErpUser();
DataTable tbl = BLLerpuser.GetList("User_Department='" + ClassCode + "'").Tables[0];
if (tbl.Rows.Count > 0)
{
TreeNode node;
for (int i = 0; i < tbl.Rows.Count; i++)
{
node = new TreeNode();
node.Text = tbl.Rows[i]["User_Name"].ToString();
node.Tag = tbl.Rows[i]["User_EmployeeID"].ToString();
node.Name = tbl.Rows[i]["User_Account"].ToString();
nodes.Add(node);
}
}
}
}
#endregion
#region 时间控件
protected override void txtTimeStart_Leave(object sender, EventArgs e)
{
if (this.txtTimeStart.Text.Trim() != "")
{
if (LYFZ.Command.Command_Validate.IsDateTime(this.txtTimeStart.Text.Trim()) == false)
{
this.txtTimeStart.Text = "";
MessageBoxCustom.Show("开始时间格式输入错误");
txtTimeStart.Text = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().AddDays(1 - LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().Day)).ToString("yyyy-MM-dd");
}
}
}
protected override void txtTimeStart_Enter(object sender, EventArgs e)
{
if (this.txtTimeStart.Text == "")
{
txtTimeStart.Text = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().AddDays(1 - LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().Day)).ToString("yyyy-MM-dd");
}
}
protected override void txtTimeEnd_Leave(object sender, EventArgs e)
{
if (this.txtTimeEnd.Text.Trim() != "")
{
if (LYFZ.Command.Command_Validate.IsDateTime(this.txtTimeEnd.Text.Trim()) == false)
{
this.txtTimeEnd.Text = "";
MessageBoxCustom.Show("结束时间格式输入错误");
txtTimeEnd.Text = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime()).ToString("yyyy-MM-dd");
}
}
}
protected override void txtTimeEnd_Enter(object sender, EventArgs e)
{
if (this.txtTimeEnd.Text == "")
{
txtTimeEnd.Text = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime()).ToString("yyyy-MM-dd");
}
}
#endregion
#region 时间查询
protected override void btnSelect_Click(object sender, EventArgs e)
{
WaitForm wf = new WaitForm();
wf.ShowForm(this);
try
{
if (string.IsNullOrEmpty(txtTsorder_OpenSingle.Text))
{
MessageBoxCustom.Show("请选择人员!");
return;
}
dgv1.Rows.Clear();
dgv2.Rows.Clear();
dgv3.Rows.Clear();
dgv4.Rows.Clear();
if (string.IsNullOrEmpty(txtTimeStart.Text) || string.IsNullOrEmpty(txtTimeEnd.Text))
{
MessageBoxCustom.Show("请输入时间!");
return;
}
LYFZ.BLL.BLL_ErpWagesSet wagesBll = new BLL.BLL_ErpWagesSet();
#region 获取人员基本信息
DataTable wagesdt = wagesBll.GetList("Ws_StaffCode='" + txtTsorder_OpenSingle.Tag.ToString() + "'").Tables[0];
if (wagesdt.Rows.Count > 0)
{
txtWs_Remark.Text = wagesdt.Rows[0]["Ws_Remark"].ToString();
txtWs_BasicWage.Text = wagesdt.Rows[0]["Ws_BasicWage"].ToString();
}
else
{
txtWs_Remark.Text = "";
txtWs_BasicWage.Text = "0.00";
}
#endregion
#region 获取列表
//订单,二销提成数据源绑定
// PaymentBind();
BindSalarylist(txtTsorder_OpenSingle.Tag.ToString(), Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
//摄影与助理数据源绑定
PhotographyBind();
//修片与精修与设计
BindPhoto();
//计件提成
BindPiece(txtTsorder_OpenSingle.Tag.ToString(), Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
#endregion
#region 获取工资
GetWages(txtTsorder_OpenSingle.Tag.ToString());
#endregion
wf.CloseForm();
wf = null;
}
catch (Exception ex)
{
wf.CloseForm();
wf = null;
MessageBoxCustom.Show(ex.Message);
}
}
#endregion
#region 获取工资
///
/// 获取工资
///
///
public void GetWages(string Tsorder_OpenSingle)
{
try
{
LYFZ.BLL.BLL_ErpSystemCategory SystemCategorybll = new BLL.BLL_ErpSystemCategory();
LYFZ.BLL.BLL_ErpWagesSet Wagebll = new BLL.BLL_ErpWagesSet();
LYFZ.BLL.BLL_ErpCommissionPercentage CommissionPercentagebll = new BLL.BLL_ErpCommissionPercentage();
LYFZ.BLL.BLL_ErpOrdersPhotography OrdersPhotographybll = new BLL.BLL_ErpOrdersPhotography();
LYFZ.BLL.BLL_ErpWageCommissionSet WageCommissionSetbll = new BLL.BLL_ErpWageCommissionSet();
LYFZ.BLL.BLL_ErpWagesSet WagesSetbll = new BLL.BLL_ErpWagesSet();
LYFZ.BLL.BLL_ErpTwoPinsProjectCommissionProportion TwoPinsProjectCommissionProportion = new BLL.BLL_ErpTwoPinsProjectCommissionProportion();
DataTable dt = new DataTable();
if (dgv1.Rows.Count > 0)
{
for (int i = 0; i < dgv1.Rows.Count; i++)
{
string Pay_OrdNumber = dgv1.Rows[i].Cells["Pay_OrdNumber"].Value.ToString();
decimal Pay_AmountOf = Convert.ToDecimal(dgv1.Rows[i].Cells["Pay_AmountOf"].Value);
string Pay_Category = dgv1.Rows[i].Cells["Pay_Category"].Value.ToString();
object OrdPe_Type = dgv1.Rows[i].Cells["OrdPe_Type"].Value;
string Pay_CustomNumber = dgv1.Rows[i].Cells["Pay_CustomNumber"].Value.ToString();
#region 获取前期业绩收款记录
#region 先获取门市提成工资比重(只能在前期收款)
if (Pay_Category == "前期收款")
{
if (OrdPe_Type != null)
{
#region
//获取主门市个数
decimal MainCount = Convert.ToDecimal(Wagebll.GetPersonCount(" OrdPe_OrderNumber='" + Pay_OrdNumber + "' and OrdPe_Type='0'").Tables[0].Rows[0]["count"]);
//获取副门市个数
decimal DeputyCount = Convert.ToDecimal(Wagebll.GetPersonCount(" OrdPe_OrderNumber='" + Pay_OrdNumber + "' and OrdPe_Type='1'").Tables[0].Rows[0]["count"]);
//获取门市比重
decimal MainProportion = 0;
decimal DeputyProportion = 0;
if (CommissionPercentagebll.GetList("Cp_ProportionCode='MainStoreProportion'").Tables[0].Rows.Count > 0)
{ MainProportion = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='MainStoreProportion'").Tables[0].Rows[0]["Cp_Proportion"]); }
else { MainProportion = 0; }
if (CommissionPercentagebll.GetList("Cp_ProportionCode='DeputyStoreProportion'").Tables[0].Rows.Count > 0)
{ DeputyProportion = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='DeputyStoreProportion'").Tables[0].Rows[0]["Cp_Proportion"]); }
else { DeputyProportion = 0; }
//如果主门市个数只有一个,则按100%比例分配
if ((MainCount == 1 && DeputyCount == 0))
{
dgv1.Rows[i].Cells["Pay_AmountOf"].Value = Pay_AmountOf.ToString("N0"); ;
}
//如果主门市个数只有一个,副门市多个 则按比例分配
if ((MainCount == 1 && DeputyCount > 0))
{
//公式 金额=(总金额/总比例)*门市比重
if (Convert.ToInt32(OrdPe_Type) == 0) //主
{
decimal MsMoney = 0;
MsMoney = Pay_AmountOf / ((MainCount * MainProportion) + (DeputyCount * DeputyProportion)) * MainProportion;
dgv1.Rows[i].Cells["Pay_AmountOf"].Value = MsMoney.ToString("N0");
}
if (Convert.ToInt32(OrdPe_Type) == 1) //副
{
decimal MsMoney = 0;
MsMoney = Pay_AmountOf / ((MainCount * MainProportion) + (DeputyCount * DeputyProportion)) * DeputyProportion;
dgv1.Rows[i].Cells["Pay_AmountOf"].Value = MsMoney.ToString("N0");
}
}
#endregion
}
else { dgv1.Rows.RemoveAt(i); }
}
#endregion
#region 获取景点比重
#region 获取参数与定义参数
//获取等级级别比重
decimal OneLevel = 0;
decimal TwoLevel = 0;
decimal ThreeLevel = 0;
if (CommissionPercentagebll.GetList("Cp_ProportionCode='BEBBBCADDEBFJDFFC'").Tables[0].Rows.Count > 0)
{ OneLevel = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='BEBBBCADDEBFJDFFC'").Tables[0].Rows[0]["Cp_Proportion"]); }
else { OneLevel = 0; }
if (CommissionPercentagebll.GetList("Cp_ProportionCode='BEBBBCADEGBGAFFJC'").Tables[0].Rows.Count > 0)
{ TwoLevel = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='BEBBBCADEGBGAFFJC'").Tables[0].Rows[0]["Cp_Proportion"]); }
else { TwoLevel = 0; }
if (CommissionPercentagebll.GetList("Cp_ProportionCode='BEBBBCADAFBHBCHCI'").Tables[0].Rows.Count > 0)
{ ThreeLevel = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='BEBBBCADAFBHBCHCI'").Tables[0].Rows[0]["Cp_Proportion"]); }
else { ThreeLevel = 0; }
//获取等级级别个数
decimal OneLevelCount = Convert.ToDecimal(Wagebll.GetAttractionsRatingCount(" Ordpg_Number='" + Pay_OrdNumber + "' and Ordpg_SightsLevel='BEBBBCADDEBFJDFFC'").Tables[0].Rows[0]["count"]);
decimal TwoLevelCount = Convert.ToDecimal(Wagebll.GetAttractionsRatingCount(" Ordpg_Number='" + Pay_OrdNumber + "' and Ordpg_SightsLevel='BEBBBCADEGBGAFFJC'").Tables[0].Rows[0]["count"]);
decimal ThreeLevelCount = Convert.ToDecimal(Wagebll.GetAttractionsRatingCount(" Ordpg_Number='" + Pay_OrdNumber + "' and Ordpg_SightsLevel='BEBBBCADAFBHBCHCI'").Tables[0].Rows[0]["count"]);
#endregion
#region 摄影前期
if (Pay_Category == "摄影前期")
{
//获取摄影比重
decimal MainPhotography = 0;
decimal DeputyPhotography = 0;
if (CommissionPercentagebll.GetList("Cp_ProportionCode='MainPhotography'").Tables[0].Rows.Count > 0)
{ MainPhotography = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='MainPhotography'").Tables[0].Rows[0]["Cp_Proportion"]); }
else { MainPhotography = 0; }
if (CommissionPercentagebll.GetList("Cp_ProportionCode='DeputyPhotography'").Tables[0].Rows.Count > 0)
{ DeputyPhotography = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='DeputyPhotography'").Tables[0].Rows[0]["Cp_Proportion"]); }
else { DeputyPhotography = 0; }
//多种条件获取工资
#region 1.如果所以景点阶段都相同
if ((OneLevelCount >= 1 && TwoLevelCount == 0 && ThreeLevelCount == 0) || (OneLevelCount == 0 && TwoLevelCount >= 1 && ThreeLevelCount == 0) || (OneLevelCount == 0 && TwoLevelCount == 0 && ThreeLevelCount >= 1))
{
decimal Attractionswages = 0; //获取景点工资
//一级
if ((OneLevelCount >= 1 && TwoLevelCount == 0 && ThreeLevelCount == 0))
{
//获取景点工资
Attractionswages = Pay_AmountOf * (100 / 100 / OneLevelCount);
//获取摄影人员
dt = OrdersPhotographybll.GetList("OrdPg_Number='" + Pay_OrdNumber + "' and OrdPg_SightsLevel='BEBBBCADDEBFJDFFC'").Tables[0];
}
//二级
if ((OneLevelCount == 0 && TwoLevelCount >= 1 && ThreeLevelCount == 0))
{
//获取景点工资
Attractionswages = Pay_AmountOf * (100 / 100 / TwoLevelCount);
//获取摄影人员
dt = OrdersPhotographybll.GetList("OrdPg_Number='" + Pay_OrdNumber + "' and OrdPg_SightsLevel='BEBBBCADEGBGAFFJC'").Tables[0];
}
//三级
if ((OneLevelCount == 0 && TwoLevelCount == 0 && ThreeLevelCount >= 1))
{
//获取景点工资
Attractionswages = Pay_AmountOf * (100 / 100 / ThreeLevelCount);
//获取摄影人员
dt = OrdersPhotographybll.GetList("OrdPg_Number='" + Pay_OrdNumber + "' and OrdPg_SightsLevel='BEBBBCADAFBHBCHCI'").Tables[0];
}
if (dt.Rows.Count > 0)
{
decimal MainAttractionsPerWages = 0; //主摄影工资
decimal DeputyAttractionsPerWages = 0; //摄影助理工资
for (int y = 0; y < dt.Rows.Count; y++)
{
string OrdPg_Photographer = dt.Rows[y]["OrdPg_Photographer"].ToString();
string OrdPg_PhotographyAssistant = dt.Rows[y]["OrdPg_PhotographyAssistant"].ToString();
//主摄影工资
if (OrdPg_Photographer == txtTsorder_OpenSingle.Tag.ToString())
{
if (!string.IsNullOrEmpty(OrdPg_Photographer) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant))
{
MainAttractionsPerWages += Attractionswages * (MainPhotography / 100);
}
else
{
MainAttractionsPerWages += Attractionswages * 1;
}
}
//摄影助理工资
if (OrdPg_PhotographyAssistant == txtTsorder_OpenSingle.Tag.ToString())
{
if (!string.IsNullOrEmpty(OrdPg_Photographer) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant))
{
DeputyAttractionsPerWages += Attractionswages * (DeputyPhotography / 100);
}
else
{
DeputyAttractionsPerWages += Attractionswages * 1;
}
}
dgv1.Rows[i].Cells["Pay_AmountOf"].Value = Convert.ToDecimal(MainAttractionsPerWages + DeputyAttractionsPerWages).ToString("N0");
}
}
}
#endregion
#region 2.如果等级不相同
// if ((OneLevelCount >= 1 && TwoLevelCount >= 1 && ThreeLevelCount >= 1))
else
{
decimal Onej = 0;//一级景点工资
decimal Twoj = 0; //二级景点工资
decimal Threej = 0; //三级景点工资
//获取景点等级总百分比
decimal AttractionsPercentage = (OneLevelCount * OneLevel) + (TwoLevelCount * TwoLevel) + (ThreeLevelCount * ThreeLevel);
Onej = Pay_AmountOf / AttractionsPercentage * OneLevel;
Twoj = Pay_AmountOf / AttractionsPercentage * TwoLevel;
Threej = Pay_AmountOf / AttractionsPercentage * ThreeLevel;
//按级别获取工资
//获取摄影人员
dt = OrdersPhotographybll.GetList("Ordpg_Number='" + Pay_OrdNumber + "'").Tables[0];
if (dt.Rows.Count > 0)
{
decimal MainAttractionsPerWages = 0; //主摄影工资
decimal DeputyAttractionsPerWages = 0; //摄影助理工资
for (int y = 0; y < dt.Rows.Count; y++)
{
string OrdPg_Photographer = dt.Rows[y]["OrdPg_Photographer"].ToString();
string OrdPg_PhotographyAssistant = dt.Rows[y]["OrdPg_PhotographyAssistant"].ToString();
string OrdPg_SightsLevel = dt.Rows[y]["OrdPg_SightsLevel"].ToString();
#region 主摄影工资
if (OrdPg_Photographer == txtTsorder_OpenSingle.Tag.ToString())
{
//一级
if (OrdPg_SightsLevel == "BEBBBCADDEBFJDFFC")
{
if (!string.IsNullOrEmpty(OrdPg_Photographer) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant))
{
MainAttractionsPerWages += Onej * (MainPhotography / 100);
}
else
{
MainAttractionsPerWages += Onej * 1;
}
}
//二级
if (OrdPg_SightsLevel == "BEBBBCADEGBGAFFJC")
{
if (!string.IsNullOrEmpty(OrdPg_Photographer) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant))
{
MainAttractionsPerWages += Twoj * (MainPhotography / 100);
}
else
{
MainAttractionsPerWages += Twoj * 1;
}
}
//三级
if (OrdPg_SightsLevel == "BEBBBCADAFBHBCHCI")
{
if (!string.IsNullOrEmpty(OrdPg_Photographer) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant))
{
MainAttractionsPerWages += Threej * (MainPhotography / 100);
}
else
{
MainAttractionsPerWages += Threej * 1;
}
}
}
#endregion
#region 摄影助理工资
if (OrdPg_PhotographyAssistant == txtTsorder_OpenSingle.Tag.ToString())
{
//一级
if (OrdPg_SightsLevel == "BEBBBCADDEBFJDFFC")
{
if (!string.IsNullOrEmpty(OrdPg_Photographer) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant))
{
DeputyAttractionsPerWages += Onej * (DeputyPhotography / 100);
}
else
{
DeputyAttractionsPerWages += Onej * 1;
}
}
//二级
if (OrdPg_SightsLevel == "BEBBBCADEGBGAFFJC")
{
if (!string.IsNullOrEmpty(OrdPg_Photographer) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant))
{
DeputyAttractionsPerWages += Twoj * (DeputyPhotography / 100);
}
else
{
DeputyAttractionsPerWages += Twoj * 1;
}
}
//三级
if (OrdPg_SightsLevel == "BEBBBCADAFBHBCHCI")
{
if (!string.IsNullOrEmpty(OrdPg_Photographer) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant))
{
DeputyAttractionsPerWages += Threej * (DeputyPhotography / 100);
}
else
{
DeputyAttractionsPerWages += Threej * 1;
}
}
}
#endregion
dgv1.Rows[i].Cells["Pay_AmountOf"].Value = Convert.ToDecimal(MainAttractionsPerWages + DeputyAttractionsPerWages).ToString("N0");
}
}
}
#endregion
}
#endregion
#region 化妆前期
if (Pay_Category == "化妆前期")
{
//获取化妆比重
decimal MainMake = 0;
decimal DeputyMake = 0;
if (CommissionPercentagebll.GetList("Cp_ProportionCode='MainMake'").Tables[0].Rows.Count > 0)
{ MainMake = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='MainMake'").Tables[0].Rows[0]["Cp_Proportion"]); }
else { MainMake = 0; }
if (CommissionPercentagebll.GetList("Cp_ProportionCode='DeputyMake'").Tables[0].Rows.Count > 0)
{ DeputyMake = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='DeputyMake'").Tables[0].Rows[0]["Cp_Proportion"]); }
else { DeputyMake = 0; }
//多种条件获取工资
#region 1.如果所以景点阶段都相同
if ((OneLevelCount >= 1 && TwoLevelCount == 0 && ThreeLevelCount == 0) || (OneLevelCount == 0 && TwoLevelCount >= 1 && ThreeLevelCount == 0) || (OneLevelCount == 0 && TwoLevelCount == 0 && ThreeLevelCount >= 1))
{
decimal Attractionswages = 0; //获取景点工资
//一级
if ((OneLevelCount >= 1 && TwoLevelCount == 0 && ThreeLevelCount == 0))
{
//获取景点工资
Attractionswages = Pay_AmountOf * (100 / 100 / OneLevelCount);
//获取化妆人员
dt = OrdersPhotographybll.GetList("Ordpg_Number='" + Pay_OrdNumber + "' and OrdPg_SightsLevel='BEBBBCADDEBFJDFFC'").Tables[0];
}
//二级
if ((OneLevelCount == 0 && TwoLevelCount >= 1 && ThreeLevelCount == 0))
{
//获取景点工资
Attractionswages = Pay_AmountOf * (100 / 100 / TwoLevelCount);
//获取化妆人员
dt = OrdersPhotographybll.GetList("Ordpg_Number='" + Pay_OrdNumber + "' and OrdPg_SightsLevel='BEBBBCADEGBGAFFJC'").Tables[0];
}
//三级
if ((OneLevelCount == 0 && TwoLevelCount == 0 && ThreeLevelCount >= 1))
{
//获取景点工资
Attractionswages = Pay_AmountOf * (100 / 100 / ThreeLevelCount);
//获取化妆人员
dt = OrdersPhotographybll.GetList("Ordpg_Number='" + Pay_OrdNumber + "' and OrdPg_SightsLevel='BEBBBCADAFBHBCHCI'").Tables[0];
}
if (dt.Rows.Count > 0)
{
decimal MainAttractionsPerWages = 0; //主化妆师工资
decimal DeputyAttractionsPerWages = 0; //化妆助理工资
for (int y = 0; y < dt.Rows.Count; y++)
{
string OrdPg_MakeupArtist = dt.Rows[y]["OrdPg_MakeupArtist"].ToString();
string OrdPg_MakeupAssistant = dt.Rows[y]["OrdPg_MakeupAssistant"].ToString();
//主化妆工资
if (OrdPg_MakeupArtist == txtTsorder_OpenSingle.Tag.ToString())
{
if (!string.IsNullOrEmpty(OrdPg_MakeupArtist) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant))
{
MainAttractionsPerWages += Attractionswages * (MainMake / 100);
}
else
{
MainAttractionsPerWages += Attractionswages * 1;
}
}
//化妆助理工资
if (OrdPg_MakeupAssistant == txtTsorder_OpenSingle.Tag.ToString())
{
if (!string.IsNullOrEmpty(OrdPg_MakeupArtist) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant))
{
DeputyAttractionsPerWages += Attractionswages * (DeputyMake / 100);
}
else
{
DeputyAttractionsPerWages += Attractionswages * 1;
}
}
dgv1.Rows[i].Cells["Pay_AmountOf"].Value = Convert.ToDecimal(MainAttractionsPerWages + DeputyAttractionsPerWages).ToString("N0");
}
}
}
#endregion
#region 2.如果等级不相同
// if ((OneLevelCount >= 1 && TwoLevelCount >= 1 && ThreeLevelCount >= 1))
else
{
decimal Onej = 0;//一级景点工资
decimal Twoj = 0; //二级景点工资
decimal Threej = 0; //三级景点工资
//获取景点等级总百分比
decimal AttractionsPercentage = (OneLevelCount * OneLevel) + (TwoLevelCount * TwoLevel) + (ThreeLevelCount * ThreeLevel);
Onej = Pay_AmountOf / AttractionsPercentage * OneLevel;
Twoj = Pay_AmountOf / AttractionsPercentage * TwoLevel;
Threej = Pay_AmountOf / AttractionsPercentage * ThreeLevel;
//按级别获取工资
//获取化妆人员
dt = OrdersPhotographybll.GetList("Ordpg_Number='" + Pay_OrdNumber + "'").Tables[0];
if (dt.Rows.Count > 0)
{
decimal MainAttractionsPerWages = 0; //主化妆工资
decimal DeputyAttractionsPerWages = 0; //化妆助理工资
for (int y = 0; y < dt.Rows.Count; y++)
{
string OrdPg_MakeupArtist = dt.Rows[y]["OrdPg_MakeupArtist"].ToString();
string OrdPg_MakeupAssistant = dt.Rows[y]["OrdPg_MakeupAssistant"].ToString();
string OrdPg_SightsLevel = dt.Rows[y]["OrdPg_SightsLevel"].ToString();
#region 主摄影工资
if (OrdPg_MakeupArtist == txtTsorder_OpenSingle.Tag.ToString())
{
//一级
if (OrdPg_SightsLevel == "BEBBBCADDEBFJDFFC")
{
if (!string.IsNullOrEmpty(OrdPg_MakeupArtist) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant))
{
MainAttractionsPerWages += Onej * (MainMake / 100);
}
else
{
MainAttractionsPerWages += Onej * 1;
}
}
//二级
if (OrdPg_SightsLevel == "BEBBBCADEGBGAFFJC")
{
if (!string.IsNullOrEmpty(OrdPg_MakeupArtist) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant))
{
MainAttractionsPerWages += Twoj * (MainMake / 100);
}
else
{
MainAttractionsPerWages += Twoj * 1;
}
}
//三级
if (OrdPg_SightsLevel == "BEBBBCADAFBHBCHCI")
{
if (!string.IsNullOrEmpty(OrdPg_MakeupArtist) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant))
{
MainAttractionsPerWages += Threej * (MainMake / 100);
}
else
{
MainAttractionsPerWages += Threej * 1;
}
}
}
#endregion
#region 摄影助理工资
if (OrdPg_MakeupAssistant == txtTsorder_OpenSingle.Tag.ToString())
{
//一级
if (OrdPg_SightsLevel == "BEBBBCADDEBFJDFFC")
{
if (!string.IsNullOrEmpty(OrdPg_MakeupArtist) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant))
{
DeputyAttractionsPerWages += Onej * (DeputyMake / 100);
}
else
{
DeputyAttractionsPerWages += Onej * 1;
}
}
//二级
if (OrdPg_SightsLevel == "BEBBBCADEGBGAFFJC")
{
if (!string.IsNullOrEmpty(OrdPg_MakeupArtist) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant))
{
DeputyAttractionsPerWages += Twoj * (DeputyMake / 100);
}
else
{
DeputyAttractionsPerWages += Twoj * 1;
}
}
//三级
if (OrdPg_SightsLevel == "BEBBBCADAFBHBCHCI")
{
if (!string.IsNullOrEmpty(OrdPg_MakeupArtist) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant))
{
DeputyAttractionsPerWages += Threej * (DeputyMake / 100);
}
else
{
DeputyAttractionsPerWages += Threej * 1;
}
}
}
#endregion
dgv1.Rows[i].Cells["Pay_AmountOf"].Value = Convert.ToDecimal(MainAttractionsPerWages + DeputyAttractionsPerWages).ToString("N0");
}
}
}
#endregion
}
#endregion
#endregion
#endregion
#region 获取后期收款比重
if (!string.IsNullOrEmpty(Pay_CustomNumber))
{
dt = new DataTable();
dt = TwoPinsProjectCommissionProportion.GetList("Tpc_CustomNumber='" + Pay_CustomNumber + "' and Tpc_OpenSingle='" + Tsorder_OpenSingle + "'").Tables[0];
if (dt.Rows.Count > 0)
{
decimal Tpc_CommissionPercentage = Convert.ToDecimal(dt.Rows[0]["Tpc_CommissionPercentage"]);
if (Tpc_CommissionPercentage > 0)
{
dgv1.Rows[i].Cells["Pay_AmountOf"].Value = Convert.ToDecimal(Pay_AmountOf * Tpc_CommissionPercentage / 100).ToString("N0");
}
else { dgv1.Rows[i].Cells["Pay_AmountOf"].Value = "0"; }
}
}
#endregion
}
}
decimal S_QQYJ = 0; //前期收款业绩
decimal S_QQYJ_SH = 0; //摄影前期,化妆前期,引导前期业绩
decimal S_EXYJ = 0; //二销业绩
decimal S_EXYJ_Tc = 0; //二销提成
decimal QQSK_TC = 0; //前期收款提成
decimal QQSK_SH_TC = 0; //摄影,化妆前期,引导前期提成
string Wcs_TypeCode = ""; //类别代码
for (int i = 0; i < dgv1.Rows.Count; i++)
{
decimal Pay_AmountOf = Convert.ToDecimal(dgv1.Rows[i].Cells["Pay_AmountOf"].Value); //金额
string Pay_Category = dgv1.Rows[i].Cells["Pay_Category"].Value.ToString(); //类别
#region 工资各业绩总额
//前期收款
if (Pay_Category == "前期收款")
{
S_QQYJ += Pay_AmountOf;
}//摄影前期,化妆前期,引导前期
else if (Pay_Category == "摄影前期" || Pay_Category == "化妆前期" || Pay_Category == "引导前期")
{
S_QQYJ_SH += Pay_AmountOf;
}
else
{
//二销业绩
S_EXYJ += Pay_AmountOf;
}
#endregion
#region 获取二销提成
if (Pay_Category != "前期收款" && Pay_Category != "摄影前期" && Pay_Category != "化妆前期" && Pay_Category != "引导前期")
{
dt = SystemCategorybll.GetList("Sc_ClassName='" + Pay_Category + "'").Tables[0];
if (dt.Rows.Count > 0)
{
Wcs_TypeCode = dt.Rows[0]["Sc_ClassCode"].ToString();
S_EXYJ_Tc += WageCommissionSetbll.GetCommissionSpecifications(Wcs_TypeCode, Convert.ToDecimal(Pay_AmountOf));
}
}
#endregion
}
//前期业绩
txtEarlyResults.Text = (S_QQYJ + S_QQYJ_SH).ToString("N2");
//二销业绩
txtTwoPinsResults.Text = S_EXYJ.ToString("N2");
//计件提成
txtPieceCommission.Text = Piece.ToString("N2");
#region 总工资
#region 获取前期提成
dt = Wagebll.GetView_WagesSet("User_EmployeeID='" + Tsorder_OpenSingle + "'").Tables[0];
if (dt.Rows.Count > 0)
{
//获取前期收款提成
if (!string.IsNullOrEmpty(dt.Rows[0]["Ws_EarlyCommissionScheme"].ToString()))
{
Wcs_TypeCode = dt.Rows[0]["Ws_EarlyCommissionScheme"].ToString();
QQSK_TC = WageCommissionSetbll.GetCommissionSpecifications(Wcs_TypeCode, Convert.ToDecimal(S_QQYJ));
}
else { QQSK_TC = 0; }
//获取摄影,化妆前期,引导前期提成
if (!string.IsNullOrEmpty(dt.Rows[0]["Ws_PhotographyMakeupCommissionScheme"].ToString()))
{
Wcs_TypeCode = dt.Rows[0]["Ws_PhotographyMakeupCommissionScheme"].ToString();
QQSK_SH_TC = WageCommissionSetbll.GetCommissionSpecifications(Wcs_TypeCode, Convert.ToDecimal(S_QQYJ_SH));
}
else { QQSK_SH_TC = 0; }
}
#endregion
#endregion
//基本工资+前期提成+二销提成+计件提成
txtTotalWages.Text = Convert.ToDecimal(Convert.ToDecimal(txtWs_BasicWage.Text) + Convert.ToDecimal(QQSK_TC + QQSK_SH_TC) + Convert.ToDecimal(S_EXYJ_Tc) + Convert.ToDecimal(txtPieceCommission.Text)).ToString("N2");
}
catch (Exception ex)
{
MessageBoxCustom.Show(ex.Message);
}
}
#endregion
#region 排序
public class RowComparer : System.Collections.IComparer
{
private static int sortOrderModifier = 1;
public RowComparer(SortOrder sortOrder)
{
if (sortOrder == SortOrder.Descending)
{
sortOrderModifier = -1;
}
else if (sortOrder == SortOrder.Ascending)
{
sortOrderModifier = 1;
}
}
public int Compare(object x, object y)
{
DataGridViewRow DataGridViewRow1 = (DataGridViewRow)x;
DataGridViewRow DataGridViewRow2 = (DataGridViewRow)y;
// Try to sort based on the First Cells
int CompareResult = System.String.Compare(DataGridViewRow1.Cells[0].Value.ToString(), DataGridViewRow2.Cells[0].Value.ToString());
// If the Last Names are equal, sort based on the Sec. Cells
if (CompareResult == 0)
{
CompareResult = System.String.Compare(DataGridViewRow1.Cells[1].Value.ToString(), DataGridViewRow2.Cells[1].Value.ToString());
}
return CompareResult * sortOrderModifier;
}
}
#endregion
#region 关闭
protected override void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
#endregion
#region 自动统计
///
/// 自动统计
///
///
///
///
public void BindAutomaticStatistics(string Tsorder_OpenSingle, string TimeStart, string TimeEnd)
{
try
{
LYFZ.BLL.BLL_ErpWagesSet wagessetbll = new BLL.BLL_ErpWagesSet();
DataTable dt = new DataTable();
#region 获取摄影师与助理
//摄影师
dt = wagessetbll.GetPhotographyCount("OrdPg_Photographer like '%" + Tsorder_OpenSingle + "%' and OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + "' and OrdPg_PhotographyStatus='1'").Tables[0];
decimal OrdPg_Photographer = Convert.ToDecimal(dt.Rows[0]["count"]);
//助理
dt = wagessetbll.GetPhotographyCount("OrdPg_PhotographyAssistant like '%" + Tsorder_OpenSingle + "%' and OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + "' and OrdPg_PhotographyStatus='1'").Tables[0];
decimal OrdPg_PhotographyAssistant = Convert.ToDecimal(dt.Rows[0]["count"]);
//化妆师
dt = wagessetbll.GetPhotographyCount("OrdPg_MakeupArtist like '%" + Tsorder_OpenSingle + "%' and OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + "' and OrdPg_PhotographyStatus='1'").Tables[0];
decimal OrdPg_MakeupArtist = Convert.ToDecimal(dt.Rows[0]["count"]);
//助理
dt = wagessetbll.GetPhotographyCount("OrdPg_MakeupAssistant like '%" + Tsorder_OpenSingle + "%' and OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + "' and OrdPg_PhotographyStatus='1'").Tables[0];
decimal OrdPg_MakeupAssistant = Convert.ToDecimal(dt.Rows[0]["count"]);
//引导师
dt = wagessetbll.GetPhotographyCount("OrdPg_BootDivision like '%" + Tsorder_OpenSingle + "%' and OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + "' and OrdPg_PhotographyStatus='1'").Tables[0];
decimal OrdPg_BootDivision = Convert.ToDecimal(dt.Rows[0]["count"]);
//总金额
dt = wagessetbll.GetPhotographySum("(OrdPg_Photographer like '%" + Tsorder_OpenSingle + "%' or OrdPg_PhotographyAssistant like '%" + Tsorder_OpenSingle + "%' or OrdPg_MakeupArtist like '%" + Tsorder_OpenSingle + "%' or OrdPg_MakeupAssistant like '%" + Tsorder_OpenSingle + "%' or OrdPg_BootDivision like '%" + Tsorder_OpenSingle + "%') and (OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + "') and OrdPg_PhotographyStatus='1'").Tables[0];
decimal Syhe = 0;
if (!string.IsNullOrEmpty(dt.Rows[0]["he"].ToString()))
{
Syhe = Convert.ToDecimal(dt.Rows[0]["he"].ToString());
}
else { Syhe = 0; }
#endregion
decimal PhotoOrd_SeriesPrice1 = 0;
decimal SelectionTwoPins1 = 0;
decimal PhotoOrd_SeriesPrice2 = 0;
decimal SelectionTwoPins2 = 0;
decimal PhotoOrd_SeriesPrice3 = 0;
decimal SelectionTwoPins3 = 0;
#region 修片与精修与设计
//修片
dt = wagessetbll.GetRetouchingCount(" Ordv_EarlyRepairNameID like '%" + Tsorder_OpenSingle + "%' and Ordv_EarlyRepairTime>='" + TimeStart + "' and Ordv_EarlyRepairTime<='" + TimeEnd + " 23:59:59.000' and Ordv_EarlyRepairStatus='1'").Tables[0];
decimal Ord_EarlyRepairNameID = Convert.ToDecimal(dt.Rows[0]["count"]);
if (Ord_EarlyRepairNameID > 0)
{
if (dgv3.Rows.Count > 0)
{
for (int i = 0; i < dgv3.Rows.Count; i++)
{
if (dgv3.Rows[i].Cells["PhotoOrd_EarlyRepairStatus"].Value.ToString() == "OK")
{
PhotoOrd_SeriesPrice1 += Convert.ToDecimal(dgv3.Rows[i].Cells["PhotoOrd_SeriesPrice"].Value);
SelectionTwoPins1 += Convert.ToDecimal(dgv3.Rows[i].Cells["SelectionTwoPins"].Value);
}
}
}
}
//精修
dt = wagessetbll.GetRetouchingCount(" Ordv_RefinementNameID like '%" + Tsorder_OpenSingle + "%' and Ordv_RefinementTime>='" + TimeStart + "' and Ordv_RefinementTime<='" + TimeEnd + " 23:59:59.000' and Ordv_RefinementStatus='1'").Tables[0];
decimal Ord_RefinementNameID = Convert.ToDecimal(dt.Rows[0]["count"]);
if (Ord_RefinementNameID > 0)
{
if (dgv3.Rows.Count > 0)
{
for (int i = 0; i < dgv3.Rows.Count; i++)
{
if (dgv3.Rows[i].Cells["PhotoOrd_RefinementStatus"].Value.ToString() == "OK")
{
PhotoOrd_SeriesPrice2 += Convert.ToDecimal(dgv3.Rows[i].Cells["PhotoOrd_SeriesPrice"].Value);
SelectionTwoPins2 += Convert.ToDecimal(dgv3.Rows[i].Cells["SelectionTwoPins"].Value);
}
}
}
}
//设计
dt = wagessetbll.GetRetouchingCount(" Ordv_DesignerNameID like '%" + Tsorder_OpenSingle + "%' and Ordv_DesignerTime>='" + TimeStart + "' and Ordv_DesignerTime<='" + TimeEnd + " 23:59:59.000' and Ordv_DesignerStatus='1'").Tables[0];
decimal Ord_DesignerNameID = Convert.ToDecimal(dt.Rows[0]["count"]);
if (Ord_DesignerNameID > 0)
{
if (dgv3.Rows.Count > 0)
{
for (int i = 0; i < dgv3.Rows.Count; i++)
{
if (dgv3.Rows[i].Cells["PhotoOrd_DesignerStatus"].Value.ToString() == "OK")
{
PhotoOrd_SeriesPrice3 += Convert.ToDecimal(dgv3.Rows[i].Cells["PhotoOrd_SeriesPrice"].Value);
SelectionTwoPins3 += Convert.ToDecimal(dgv3.Rows[i].Cells["SelectionTwoPins"].Value);
}
}
}
}
#endregion
#region 显示文本
StringBuilder str = new StringBuilder();
str.Append("摄影师与助理\r\n");
str.Append("摄影师:" + OrdPg_Photographer + "\r\n");
str.Append("助理:" + OrdPg_PhotographyAssistant + "\r\n");
str.Append("化妆师:" + OrdPg_MakeupArtist + "\r\n");
str.Append("助理:" + OrdPg_MakeupAssistant + "\r\n");
str.Append("引导师:" + OrdPg_BootDivision + "\r\n");
str.Append("订单总金额:" + Syhe + "\r\n");
str.Append("\r\n");
str.Append("修片与精修与设计\r\n");
str.Append("初修:" + Ord_EarlyRepairNameID + "单\r\n");
str.Append("订单总金额:" + PhotoOrd_SeriesPrice1 + "\r\n");
str.Append("选片总金额:" + SelectionTwoPins1 + "\r\n");
str.Append("\r\n");
str.Append("精修:" + Ord_RefinementNameID + "单\r\n");
str.Append("订单总金额:" + PhotoOrd_SeriesPrice2 + "\r\n");
str.Append("选片总金额:" + SelectionTwoPins2 + "\r\n");
str.Append("\r\n");
str.Append("设计:" + Ord_DesignerNameID + "单\r\n");
str.Append("订单总金额:" + PhotoOrd_SeriesPrice3 + "\r\n");
str.Append("选片总金额:" + SelectionTwoPins3 + "\r\n");
txtAutomaticStatistics.Text = str.ToString();
#endregion
}
catch (Exception ex)
{
MessageBoxCustom.Show(ex.Message);
}
}
#endregion
#region 导出
protected override void btnExport4_Click(object sender, EventArgs e)
{
try
{
this.dgv4.ExportDataTable();
}
catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
}
protected override void btnExport3_Click(object sender, EventArgs e)
{
try
{
this.dgv3.ExportDataTable();
}
catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
}
protected override void btnExport2_Click(object sender, EventArgs e)
{
try
{
this.dgv2.ExportDataTable();
}
catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
}
protected override void btnExport1_Click(object sender, EventArgs e)
{
try
{
this.dgv1.ExportDataTable();
}
catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
}
#endregion
}
}