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 FrmStatisticalInquiryAllWages : LYFZ.Software.UI.StatisticalInquiry.FrmStatisticalInquiryAllWages
{
public FrmStatisticalInquiryAllWages()
{
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");
bind();
}
#region 加载数据
decimal Sum_1 = 0;
decimal Sum_2 = 0;
decimal Sum_3 = 0;
decimal Sum_4 = 0;
decimal Sum_5 = 0;
protected override void FrmStatisticalInquiryAllWages_Shown(object sender, EventArgs e)
{
WaitForm wf = new WaitForm();
wf.ShowForm(this);
try
{
#region 权限设置
#region 导出
if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StatisticalInquiryAllWagesCompetence, CustomAttributes.OperatingAuthority.DataExport))
{
btnExport.Enabled = true;
}
else
{
btnExport.Enabled = false;
}
#endregion
#region 打印
if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StatisticalInquiryAllWagesCompetence, CustomAttributes.OperatingAuthority.Print))
{
btnPrint.Enabled = true;
}
else
{
btnPrint.Enabled = false;
}
#endregion
#endregion
wf.CloseForm();
wf = null;
}
catch
{
wf.CloseForm();
wf = null;
}
}
///
/// 绑定数据
///
public void bind()
{
try
{
Sum_1 = 0;
Sum_2 = 0;
Sum_3 = 0;
Sum_4 = 0;
Sum_5 = 0;
QQYJ_TC = 0;
EXYJ_TC = 0;
YJTC_TC = 0;
Piece = 0;
S_EXYJ_Tc = 0;
QQSK_TC = 0;
QQSK_SH_TC = 0;
LYFZ.BLL.BLL_ErpWagesSet bll = new BLL.BLL_ErpWagesSet();
DataTable dt = bll.GetView_WagesSet("").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]["User_EmployeeID"].ToString().Trim();
dgvr.Cells.Add(cell);
//姓名
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["User_Name"].ToString().Trim();
dgvr.Cells.Add(cell);
//总工资
cell = new DataGridViewTextBoxCell();
cell.Value = "";
dgvr.Cells.Add(cell);
//基本工资
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ws_BasicWage"].ToString() == "" ? "0.00" : dt.Rows[t]["Ws_BasicWage"].ToString();
dgvr.Cells.Add(cell);
Sum_1 += Convert.ToDecimal(dt.Rows[t]["Ws_BasicWage"].ToString() == "" ? "0.00" : dt.Rows[t]["Ws_BasicWage"].ToString());
//前期业绩
cell = new DataGridViewTextBoxCell();
cell.Value = "";
dgvr.Cells.Add(cell);
//后期业绩
cell = new DataGridViewTextBoxCell();
cell.Value = "";
dgvr.Cells.Add(cell);
//计件提成
cell = new DataGridViewTextBoxCell();
cell.Value = "";
dgvr.Cells.Add(cell);
//部门
cell = new DataGridViewTextBoxCell();
LYFZ.BLL.BLL_ErpUser userbll = new BLL.BLL_ErpUser();
cell.Value = userbll.GetView_tb_ErpUser("User_EmployeeID='" + dt.Rows[t]["User_EmployeeID"] + "'").Tables[0].Rows[0]["Dt_Name"].ToString();
dgvr.Cells.Add(cell);
//备注
cell = new DataGridViewTextBoxCell();
cell.Value = dt.Rows[t]["Ws_Remark"].ToString().Trim();
dgvr.Cells.Add(cell);
if (dgv.Columns.Count != 0)
{
this.dgv.Rows.Add(dgvr);
}
#endregion
}
}
this.dgv.ClearSelection();
#region 获取工资
if (dgv.Rows.Count > 0)
{
for (int i = 0; i < dgv.Rows.Count; i++)
{
dgv1.Rows.Clear();
dgv4.Rows.Clear();
string Ws_BasicWage = dgv.Rows[i].Cells["Ws_BasicWage"].Value.ToString();
string User_EmployeeID = dgv.Rows[i].Cells["User_EmployeeID"].Value.ToString();
BindSalarylist(User_EmployeeID, Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
BindPiece(User_EmployeeID, Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
GetWages(User_EmployeeID);
//前期业绩
dgv.Rows[i].Cells["PreliminaryResults"].Value = QQYJ_TC.ToString("N2");
Sum_2 += QQYJ_TC;
//后期业绩
dgv.Rows[i].Cells["LateResults"].Value = EXYJ_TC.ToString("N2");
Sum_3 += EXYJ_TC;
//计件提成
dgv.Rows[i].Cells["PieceCommission"].Value = YJTC_TC.ToString("N2");
Sum_4 += YJTC_TC;
//string PieceCommission = dgv.Rows[i].Cells["PieceCommission"].Value.ToString();
//总业绩
dgv.Rows[i].Cells["TotalWages"].Value = Convert.ToDecimal(Convert.ToDecimal(Ws_BasicWage) + Convert.ToDecimal(QQSK_TC + QQSK_SH_TC) + Convert.ToDecimal(S_EXYJ_Tc) + Convert.ToDecimal(YJTC_TC)).ToString("N2");
Sum_5 += Convert.ToDecimal(Convert.ToDecimal(Ws_BasicWage) + Convert.ToDecimal(QQSK_TC + QQSK_SH_TC) + Convert.ToDecimal(S_EXYJ_Tc) + Convert.ToDecimal(YJTC_TC));
}
}
#region 增加最后一行
int rows = dgv.Rows.Add();
dgv.Rows[rows].Cells[1].Value = "统计:";
dgv.Rows[rows].Cells[2].Value = Sum_5.ToString("N2");
dgv.Rows[rows].Cells[3].Value = Sum_1.ToString("N2");
dgv.Rows[rows].Cells[4].Value = Sum_2.ToString("N2");
dgv.Rows[rows].Cells[5].Value = Sum_3.ToString("N2");
dgv.Rows[rows].Cells[6].Value = Sum_4.ToString("N2");
#endregion
#endregion
}
catch
{
}
}
#endregion
#region
#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='" + Tsorder_OpenSingle + "'").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 BindPiece(string Tsorder_OpenSingle, string TimeStart, string TimeEnd)
{
try
{
dgv4.Rows.Clear();
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
decimal QQYJ_TC = 0;
decimal EXYJ_TC = 0;
decimal YJTC_TC = 0;
decimal Piece = 0; //计件提成
decimal S_EXYJ_Tc = 0;
decimal QQSK_TC = 0;
decimal QQSK_SH_TC = 0;
#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 == Tsorder_OpenSingle)
{
if (!string.IsNullOrEmpty(OrdPg_Photographer) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant))
{
MainAttractionsPerWages += Attractionswages * (MainPhotography / 100);
}
else
{
MainAttractionsPerWages += Attractionswages * 1;
}
}
//摄影助理工资
if (OrdPg_PhotographyAssistant == Tsorder_OpenSingle)
{
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 == Tsorder_OpenSingle)
{
//一级
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 == Tsorder_OpenSingle)
{
//一级
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 == Tsorder_OpenSingle)
{
if (!string.IsNullOrEmpty(OrdPg_MakeupArtist) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant))
{
MainAttractionsPerWages += Attractionswages * (MainMake / 100);
}
else
{
MainAttractionsPerWages += Attractionswages * 1;
}
}
//化妆助理工资
if (OrdPg_MakeupAssistant == Tsorder_OpenSingle)
{
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 == Tsorder_OpenSingle)
{
//一级
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 == Tsorder_OpenSingle)
{
//一级
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
}
//前期业绩
QQYJ_TC = S_QQYJ + S_QQYJ_SH;
//二销业绩
EXYJ_TC = S_EXYJ;
//计件提成
YJTC_TC = Piece;
#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
#endregion
#region 时间查询
protected override void btnSelect_Click(object sender, EventArgs e)
{
WaitForm wf = new WaitForm();
wf.ShowForm(this);
try
{
dgv.Rows.Clear();
bind();
wf.CloseForm();
wf = null;
}
catch
{
wf.CloseForm();
wf = null;
}
}
#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 btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
#endregion
#region 查看详情
protected override void btnViewDetails_Click(object sender, EventArgs e)
{
try
{
if (this.dgv.SelectedRows.Count == 0)
{
MessageBoxCustom.Show("请选中你要查看的数据!");
return;
}
if (dgv.CurrentRow.Cells["User_Name"].Value.ToString() == "统计:")
{
MessageBoxCustom.Show("此行是合计列不能查看!");
return;
}
LYFZ.Software.MainBusiness.StatisticalInquiry.FrmStatisticalInquiryPayroll frm = new FrmStatisticalInquiryPayroll();
frm.User_EmployeeID = dgv.CurrentRow.Cells["User_EmployeeID"].Value.ToString();
frm.TimeStart = Convert.ToDateTime(txtTimeStart.Text.Trim()).ToString("yyyy-MM-dd");
frm.TimeEnd = Convert.ToDateTime(txtTimeEnd.Text.Trim()).ToString("yyyy-MM-dd");
frm.ShowDialog();
}
catch (Exception ex)
{
MessageBoxCustom.Show(ex.Message);
}
}
#endregion
#region 导出
protected override void btnExport_Click(object sender, EventArgs e)
{
try
{
dgv.ExportDataTable();
}
catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
}
#endregion
#region 打印
protected override void btnPrint_Click(object sender, EventArgs e)
{
}
#endregion
}
}