123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941 |
- 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;
- }
- }
- /// <summary>
- /// 绑定数据
- /// </summary>
- 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 订单,二销提成数据源绑定
- /// <summary>
- /// 订单,二销提成数据源绑定
- /// </summary>
- /// <param name="Tsorder_OpenSingle"></param>
- /// <param name="TimeStart"></param>
- /// <param name="TimeEnd"></param>
- 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 获取工资
- /// <summary>
- /// 获取工资
- /// </summary>
- /// <param name="Tsorder_OpenSingle"></param>
- 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
- }
- }
|