123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827 |
- using LYFZ.ComponentLibrary;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.InitialSet
- {
- public partial class PackagesGoodsSetFormMain : LYFZ.Software.UI.InitialSet.PackagesGoodsSetFormMain
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpProduct ptbll = new BLL.BLL_ErpProduct();
- LYFZ.BLL.BLL_ErpPackages pkbll = new BLL.BLL_ErpPackages();
- LYFZ.BLL.BLL_ErpTheScenery tsbll = new BLL.BLL_ErpTheScenery();
- LYFZ.BLL.BLL_ErpPackagesGiftMerchandise pgmbll = new BLL.BLL_ErpPackagesGiftMerchandise();
- public PackagesGoodsSetFormMain(string StrType = "0")
- {
- if (!string.IsNullOrEmpty(StrType))
- { this.StrPackagesType = Convert.ToInt32(StrType); }
- else
- { this.StrPackagesType = 0; }
- this.Load += PackagesGoodsSetFormMain_Load;
- this.Shown += PackagesGoodsSetFormMain_Shown;
- this.cmbtreev_PackageName.ComboBoxTree_NodeMouseClick += cmbtreev_PackageName_ComboBoxTree_NodeMouseClick;
- this.btnToolbox_Product.Click += btnToolbox_Product_Click;
- this.btnToolbox_Service.Click += btnToolbox_Service_Click;
- this.btnToolbox_Sights.Click += btnToolbox_Sights_Click;
- this.btnDelete_Product.Click += btnDelete_Product_Click;
- this.btnDelete_Service.Click += btnDelete_Service_Click;
- this.btnDelete_Sights.Click += btnDelete_Sights_Click;
- this.btnSaveed.Click += btnSaveed_Click;
- this.btnCloseed.Click += btnCloseed_Click;
- this.btnSet.Click += btnSet_Click;
- this.btnUp.Click += btnUp_Click;
- this.btnDown.Click += btnDown_Click;
- this.TabControl.SelectedIndexChanged += TabControl_SelectedIndexChanged;
- this.listViewData_Product.MouseDoubleClick += listViewData_Product_MouseDoubleClick;
- this.listViewData_Service.MouseDoubleClick += listViewData_Service_MouseDoubleClick;
- this.listViewData_Sights.MouseDoubleClick += listViewData_Sights_MouseDoubleClick;
- this.listViewData_Stages.MouseDoubleClick += listViewData_Stages_MouseDoubleClick;
- this.listViewData_Product.MouseDown += listViewData_Product_MouseDown;
- this.listViewData_Service.MouseDown += listViewData_Service_MouseDown;
- this.txtText.KeyPress += txtText_KeyPress;
- this.txtText.Leave += txtText_Leave;
- this.txtIntoRegister.KeyPress += txtIntoRegister_KeyPress;
- this.txtIntoBottom.KeyPress += txtIntoBottom_KeyPress;
- this.FormClosing += PackagesGoodsSetFormMain_FormClosing;
- }
- /// <summary>
- /// 套系大类类型
- /// </summary>
- public int StrPackagesType;
- /// <summary>
- /// 是否保存
- /// </summary>
- public bool IsSaveed = false;
- /// <summary>
- /// 套系设置是否有修改
- /// </summary>
- private bool IsPackagesSet = false;
- /// <summary>
- /// 存储产品略图集合
- /// </summary>
- ImageList mlistImage = new ImageList();
- /// <summary>
- /// true为首次运行
- /// </summary>
- private bool IsFirstLoad = true;
- /// <summary>
- /// 套系数据是否有变动过
- /// </summary>
- private bool IsDataChange = false;
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void PackagesGoodsSetFormMain_Load(object sender, EventArgs e)
- {
- this.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- this.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- if (this.StrPackagesType == 1)
- {
- this.panelEx4.Visible = false;
- this.Text = "礼包套系商品设置";
- this.labelEx6.Text = "套系礼包商品";
- this.labelEx8.Text = "套系礼包服务";
- }
- else
- { this.txtIntoBottom.WaterText = "-1表示全送"; }
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void PackagesGoodsSetFormMain_Shown(object sender, EventArgs e)
- {
- //获取绑定拍摄次数 获取绑定套系名称
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_PackagesCategoryAndName(this.cmbtreev_PackageName, StrParentCode: Enum.GetName(typeof(LYFZ.EnumPublic.EnumPackagesType), StrPackagesType).ToString().Trim());
- this.tabPage1.Parent = null;
- this.tabPage2.Parent = null;
- switch (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
- {
- case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版:
- if (!LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition)
- {
- this.tabPage2.Parent = this.TabControl;
- this.btnUp.Visible = true;
- this.btnDown.Visible = true;
- }
- else
- {
- this.tabPage1.Parent = this.TabControl;
- this.tabPage2.Parent = this.TabControl;
- }
- break;
- case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版:
- this.tabPage1.Parent = this.TabControl;
- break;
- default:
- this.tabPage1.Parent = this.TabControl;
- this.tabPage2.Parent = this.TabControl;
- break;
- }
- //权限设置
- if (this.StrPackagesType == 0)
- {
- if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.PackagesGoodsCompetence, CustomAttributes.OperatingAuthority.Add) || LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.PackagesGoodsCompetence, CustomAttributes.OperatingAuthority.Update))
- { this.btnSaveed.Enabled = true; this.btnSet.Enabled = true; }
- else
- { this.btnSaveed.Enabled = false; this.btnSet.Enabled = false; }
- this.btnDelete_Product.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.PackagesGoodsCompetence, CustomAttributes.OperatingAuthority.Delete);
- }
- else
- {
- if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.PackagesSuperposedCompetence, CustomAttributes.OperatingAuthority.Add) || LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.PackagesSuperposedCompetence, CustomAttributes.OperatingAuthority.Update))
- { this.btnSaveed.Enabled = true; this.btnSet.Enabled = true; }
- else
- { this.btnSaveed.Enabled = false; this.btnSet.Enabled = false; }
- this.btnDelete_Product.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.PackagesSuperposedCompetence, CustomAttributes.OperatingAuthority.Delete);
- }
- this.btnDelete_Service.Enabled = this.btnDelete_Product.Enabled;
- this.btnDelete_Sights.Enabled = this.btnDelete_Product.Enabled;
- #region 设置列表标题
- #region 商品表标题
- this.listViewData_Product.View = View.Details;
- this.listViewData_Product.GridLines = true;
- string[] StrColumns = "商品名称,数量,进货价格,销售单价".Split(',');
- int SurplusCount = 90 + 85 + 85 + 23;
- for (int i = 0; i < StrColumns.Length; i++)
- {
- ColumnHeader ch = new ColumnHeader();
- ch.Text = StrColumns[i].Trim();
- ch.TextAlign = HorizontalAlignment.Left;
- if (i == 0)
- { ch.Width = this.listViewData_Product.Width - SurplusCount; }
- else if (i == StrColumns.Length - 1)
- { ch.Width = 90; }
- else
- { ch.Width = 85; }
- switch (StrColumns[i].Trim())
- {
- case "进货价格":
- case "销售单价":
- ch.TextAlign = HorizontalAlignment.Right;
- break;
- default:
- ch.TextAlign = HorizontalAlignment.Center;
- break;
- }
- this.listViewData_Product.Columns.Add(ch);
- }
- this.mlistImage.ImageSize = new Size(25, 25);
- this.mlistImage.ColorDepth = ColorDepth.Depth32Bit;
- this.listViewData_Product.SmallImageList = mlistImage;
- this.listViewData_Product.MultiSelect = true;
- #endregion
- #region 服务表标题
- this.listViewData_Service.View = View.Details;
- this.listViewData_Service.GridLines = true;
- for (int i = 0; i < StrColumns.Length; i++)
- {
- ColumnHeader ch = new ColumnHeader();
- ch.Text = StrColumns[i].Trim();
- ch.TextAlign = HorizontalAlignment.Left;
- if (i == 0)
- { ch.Width = this.listViewData_Service.Width - SurplusCount; }
- else if (i == StrColumns.Length - 1)
- { ch.Width = 90; }
- else
- { ch.Width = 85; }
- switch (StrColumns[i].Trim())
- {
- case "进货价格":
- case "销售单价":
- ch.TextAlign = HorizontalAlignment.Right;
- break;
- default:
- ch.TextAlign = HorizontalAlignment.Center;
- break;
- }
- this.listViewData_Service.Columns.Add(ch);
- }
- this.listViewData_Service.SmallImageList = mlistImage;
- this.listViewData_Service.MultiSelect = true;
- #endregion
- #region 景点表标题
- this.listViewData_Sights.View = View.Details;
- this.listViewData_Sights.GridLines = true;
- ImageList imgList = new ImageList();
- imgList.ImageSize = new Size(1, 25);
- this.listViewData_Sights.SmallImageList = imgList;
- StrColumns = "景点名称,服装套数,成本单价,销售单价".Split(',');
- SurplusCount = 90 + 85 + 85 + 23;
- for (int i = 0; i < StrColumns.Length; i++)
- {
- ColumnHeader ch = new ColumnHeader();
- ch.Text = StrColumns[i].Trim();
- ch.TextAlign = HorizontalAlignment.Left;
- if (i == 0)
- { ch.Width = this.listViewData_Sights.Width - SurplusCount; }
- else if (i == StrColumns.Length - 1)
- { ch.Width = 90; }
- else
- { ch.Width = 85; }
- switch (StrColumns[i].Trim())
- {
- case "成本单价":
- case "销售单价":
- ch.TextAlign = HorizontalAlignment.Right;
- break;
- default:
- ch.TextAlign = HorizontalAlignment.Center;
- break;
- }
- this.listViewData_Sights.Columns.Add(ch);
- }
- #endregion
- #region 拍摄次数表标题
- this.listViewData_Stages.View = View.Details;
- this.listViewData_Stages.GridLines = true;
- this.listViewData_Stages.SmallImageList = imgList;
- StrColumns = "次数名称,入册,入底,服装套数".Split(',');
- for (int i = 0; i < StrColumns.Length; i++)
- {
- ColumnHeader ch = new ColumnHeader();
- ch.Text = StrColumns[i].Trim();
- switch (StrColumns[i].Trim())
- {
- case "次数名称": ch.Width = this.listViewData_Stages.Width - 270 - 23; break;
- case "入册": ch.Width = 90; break;
- case "入底": ch.Width = 90; break;
- case "服装套数": ch.Width = 90; break;
- }
- switch (StrColumns[i].Trim())
- {
- case "次数名称": ch.TextAlign = HorizontalAlignment.Left; break;
- case "入册":
- case "入底":
- case "服装套数": ch.TextAlign = HorizontalAlignment.Center; break;
- }
- this.listViewData_Stages.Columns.Add(ch);
- }
- #endregion
- #endregion
- this.IsFirstLoad = false;
- }
- /// <summary>
- /// 套系名称选择设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void cmbtreev_PackageName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
- {
- this.listViewData_Product.Items.Clear();
- this.listViewData_Product.Groups.Clear();
- this.listViewData_Service.Items.Clear();
- this.listViewData_Service.Groups.Clear();
- this.listViewData_Sights.Items.Clear();
- this.listViewData_Stages.Items.Clear();
- this.IsDataChange = false;
- //获取套系名称资料
- DataTable dt = orbll.GetView_Custom("tb_ErpPackages", StrWhere: "Pak_PackagesID='" + this.cmbtreev_PackageName.Tag.ToString().Trim() + "'", ShowColumnName: "Pak_UnitPrice,Pak_IntoTheArchive,Pak_IntoTheBook").Tables[0];
- if (dt.Rows.Count > 0)
- {
- this.lblPakUnitPrice.Text = "套系价格:" + dt.Rows[0]["Pak_UnitPrice"].ToString().Trim();
- this.txtIntoRegister.Text = dt.Rows[0]["Pak_IntoTheBook"].ToString().Trim();
- this.txtIntoBottom.Text = dt.Rows[0]["Pak_IntoTheArchive"].ToString().Trim();
- #region 景点与次数
- DataTable tblSights = orbll.GetView_Custom("tb_ErpPackagesGiftMerchandise Left Join tb_ErpTheScenery on tb_ErpTheScenery.ID = Pgm_ProductNumber", StrWhere: "Tsc_Name is not null And Pgm_PackagesCode = '" + this.cmbtreev_PackageName.Tag.ToString().Trim() + "' And Pgm_GiveType in (2,3)", ShowColumnName: "tb_ErpPackagesGiftMerchandise.ID,Pgm_GiveType,Pgm_PackagesCode,Pgm_ProductNumber,Pgm_Quantity,Tsc_Name,Tsc_CostPrice,Tsc_SalesPrice,Pgm_IntoRegisterQuantity,Pgm_IntoBottomQuantity").Tables[0];
- for (int i = 0; i < tblSights.Rows.Count; i++)
- {
- ListViewItem lvItem = new ListViewItem();
- lvItem.Tag = tblSights.Rows[i]["Pgm_ProductNumber"].ToString().Trim() + "|" + tblSights.Rows[i]["ID"].ToString().Trim();
- lvItem.Text = tblSights.Rows[i]["Tsc_Name"].ToString().Trim();
- if (tblSights.Rows[i]["Pgm_GiveType"].ToString().Trim() == "2")
- {
- ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "服装套数";
- ListSubItem.Text = tblSights.Rows[i]["Pgm_Quantity"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "成本单价";
- ListSubItem.Text = tblSights.Rows[i]["Tsc_CostPrice"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "销售单价";
- ListSubItem.Text = tblSights.Rows[i]["Tsc_SalesPrice"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- if ((this.listViewData_Sights.Items.Count % 2) > 0)
- { lvItem.BackColor = System.Drawing.Color.PapayaWhip; }
- else
- { lvItem.BackColor = System.Drawing.Color.PowderBlue; }
- this.listViewData_Sights.Items.Add(lvItem);
- }
- else if (tblSights.Rows[i]["Pgm_GiveType"].ToString().Trim() == "3")
- {
- ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "入册";
- ListSubItem.Text = tblSights.Rows[i]["Pgm_IntoRegisterQuantity"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "入底";
- ListSubItem.Text = tblSights.Rows[i]["Pgm_IntoBottomQuantity"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "服装套数";
- ListSubItem.Text = tblSights.Rows[i]["Pgm_Quantity"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- if ((this.listViewData_Stages.Items.Count % 2) > 0)
- { lvItem.BackColor = System.Drawing.Color.PapayaWhip; }
- else
- { lvItem.BackColor = System.Drawing.Color.PowderBlue; }
- ListViewGroup man_lvg = new ListViewGroup();
- man_lvg.Tag = lvItem.Text;
- man_lvg.Name = lvItem.Text;
- man_lvg.Header = lvItem.Text;
- man_lvg.HeaderAlignment = HorizontalAlignment.Left;
- this.listViewData_Product.Groups.Add(man_lvg);
- man_lvg = new ListViewGroup();
- man_lvg.Tag = lvItem.Text;
- man_lvg.Name = lvItem.Text;
- man_lvg.Header = lvItem.Text;
- man_lvg.HeaderAlignment = HorizontalAlignment.Left;
- this.listViewData_Service.Groups.Add(man_lvg);
- this.listViewData_Stages.Items.Add(lvItem);
- }
- }
- #endregion
- #region 商品与服务
- if (this.tabPage2.Parent == null)
- {
- string StrTableName = "(select Prod_Class,Sc_ClassName,Pgm_GiveType,Pgm_PackagesCode from tb_ErpPackagesGiftMerchandise Left Join tb_ErpProduct on Prod_Number = Pgm_ProductNumber " +
- "Left Join tb_ErpSystemCategory on Prod_Class = Sc_ClassCode Group by Prod_Class,Sc_ClassName,Pgm_GiveType,Pgm_PackagesCode ) as tb";
- DataTable dtGroup = orbll.GetView_Custom(StrTableName, StrWhere: "Pgm_PackagesCode = '" + this.cmbtreev_PackageName.Tag.ToString().Trim() + "' And Pgm_GiveType in ('0','1')", ShowColumnName: "*").Tables[0];
- ListViewGroup man_lvg = null;
- for (int i = 0; i < dtGroup.Rows.Count; i++)
- {
- man_lvg = new ListViewGroup();
- man_lvg.Tag = dtGroup.Rows[i]["Sc_ClassName"].ToString().Trim();
- man_lvg.Name = dtGroup.Rows[i]["Prod_Class"].ToString().Trim();
- man_lvg.Header = dtGroup.Rows[i]["Sc_ClassName"].ToString().Trim();
- man_lvg.HeaderAlignment = HorizontalAlignment.Left;
- if (dtGroup.Rows[i]["Pgm_GiveType"].ToString().Trim() == "0")
- { this.listViewData_Product.Groups.Add(man_lvg); }
- else if (dtGroup.Rows[i]["Pgm_GiveType"].ToString().Trim() == "1")
- { this.listViewData_Service.Groups.Add(man_lvg); }
- }
- }
- else
- {
- ListViewGroup man_lvg = new ListViewGroup();
- man_lvg.Tag = "";
- man_lvg.Name = "NotGroup";
- man_lvg.Header = "未分组";
- man_lvg.HeaderAlignment = HorizontalAlignment.Left;
- this.listViewData_Product.Groups.Add(man_lvg);
- man_lvg = new ListViewGroup();
- man_lvg.Tag = "";
- man_lvg.Name = "NotGroup";
- man_lvg.Header = "未分组";
- man_lvg.HeaderAlignment = HorizontalAlignment.Left;
- this.listViewData_Service.Groups.Add(man_lvg);
- }
- DataTable tblProduct = orbll.GetView_Custom("tb_ErpPackagesGiftMerchandise Left Join tb_ErpProduct on Prod_Number = Pgm_ProductNumber", StrWhere: "Pgm_PackagesCode = '" + this.cmbtreev_PackageName.Tag.ToString().Trim() + "' And Pgm_GiveType in ('0','1')", ShowColumnName: "tb_ErpPackagesGiftMerchandise.ID,Pgm_GiveType,Pgm_PackagesCode,Pgm_Quantity,Prod_Number,Prod_Name,Prod_CostPrice,Prod_SalesPrice,Prod_Thumbnail,Prod_Class,Pgm_ProductGroupName").Tables[0];
- for (int i = 0; i < tblProduct.Rows.Count; i++)
- {
- if (!this.mlistImage.Images.Keys.Contains(tblProduct.Rows[i]["Prod_Number"].ToString().Trim()))
- {
- Image img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetProductImage(tblProduct.Rows[i]["Prod_Thumbnail"].ToString().Trim());
- this.mlistImage.Images.Add(tblProduct.Rows[i]["Prod_Number"].ToString().Trim(), img);
- }
- ListViewItem lvItem = new ListViewItem();
- lvItem.Tag = tblProduct.Rows[i]["Prod_Number"].ToString().Trim() + "|" + tblProduct.Rows[i]["ID"].ToString().Trim();
- lvItem.ImageKey = tblProduct.Rows[i]["Prod_Number"].ToString().Trim();
- lvItem.Text = tblProduct.Rows[i]["Prod_Name"].ToString().Trim();
- if (tblProduct.Rows[i]["Prod_Number"]==null||string.IsNullOrEmpty(tblProduct.Rows[i]["Prod_Number"].ToString()))
- {
- lvItem.Text = "此产品已在产品设置表中删除";
- lvItem.ForeColor = Color.Red;
- }
- ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "数量";
- ListSubItem.Text = tblProduct.Rows[i]["Pgm_Quantity"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "进货价格";
- ListSubItem.Text = tblProduct.Rows[i]["Prod_CostPrice"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "销售单价";
- ListSubItem.Text = tblProduct.Rows[i]["Prod_SalesPrice"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- if (tblProduct.Rows[i]["Pgm_GiveType"].ToString().Trim() == "0")
- {
- if (this.tabPage2.Parent == null)
- {
- if (this.listViewData_Product.Groups.Count > 0)
- { this.listViewData_Product.Groups[tblProduct.Rows[i]["Prod_Class"].ToString().Trim()].Items.Add(lvItem); }
- }
- else
- {
- if (!string.IsNullOrEmpty(tblProduct.Rows[i]["Pgm_ProductGroupName"].ToString().Trim()))
- {
- if (this.listViewData_Product.Groups[tblProduct.Rows[i]["Pgm_ProductGroupName"].ToString().Trim()] != null)
- { this.listViewData_Product.Groups[tblProduct.Rows[i]["Pgm_ProductGroupName"].ToString().Trim()].Items.Add(lvItem); }
- else
- { this.listViewData_Product.Groups["NotGroup"].Items.Add(lvItem); }
- }
- else
- { this.listViewData_Product.Groups["NotGroup"].Items.Add(lvItem); }
- }
- this.listViewData_Product.Items.Add(lvItem);
- }
- else if (tblProduct.Rows[i]["Pgm_GiveType"].ToString().Trim() == "1")
- {
- if (this.tabPage2.Parent == null)
- {
- if (this.listViewData_Service.Groups[tblProduct.Rows[i]["Prod_Class"].ToString().Trim()] != null)
- { this.listViewData_Service.Groups[tblProduct.Rows[i]["Prod_Class"].ToString().Trim()].Items.Add(lvItem); }
- }
- else
- {
- if (!string.IsNullOrEmpty(tblProduct.Rows[i]["Pgm_ProductGroupName"].ToString().Trim()))
- {
- if (this.listViewData_Service.Groups.Count > 0 && this.listViewData_Service.Groups[tblProduct.Rows[i]["Pgm_ProductGroupName"].ToString().Trim()]!=null)
- { this.listViewData_Service.Groups[tblProduct.Rows[i]["Pgm_ProductGroupName"].ToString().Trim()].Items.Add(lvItem); }
- else
- { this.listViewData_Service.Groups["NotGroup"].Items.Add(lvItem); }
- }
- else
- { this.listViewData_Service.Groups["NotGroup"].Items.Add(lvItem); }
- }
- this.listViewData_Service.Items.Add(lvItem);
- }
- }
- this.ListViewDrawSingleOrDoubleRows(ListViewType.套系商品);
- this.ListViewDrawSingleOrDoubleRows(ListViewType.套系服务);
- #endregion
- }
- else
- {
- this.lblPakUnitPrice.Text = "套系价格:0";
- MessageBoxCustom.Show(this.cmbtreev_PackageName.Text.ToString() + " 此类型无套系名称!请添加套系名称");
- this.cmbtreev_PackageName.SetTextAndTag_ValueNull();
- }
- this.GetSeriesCostsPriceStatistics();
- }
- /// <summary>
- /// 商品工具箱_产品
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnToolbox_Product_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.cmbtreev_PackageName.Text))
- { MessageBoxCustom.Show("请选择套系名称!"); return; }
- LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ToolboxListViewSamllForm frm = new DoorCityProcess.SetSmallForm.ToolboxListViewSamllForm();
- frm.LoadType = "套系包含商品";
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- for (int i = 0; i < frm.mlist_SmallImage.Images.Keys.Count; i++)
- {
- if (!this.mlistImage.Images.Keys.Contains(frm.mlist_SmallImage.Images.Keys[i].Trim()))
- { this.mlistImage.Images.Add(frm.mlist_SmallImage.Images.Keys[i].Trim(), frm.mlist_SmallImage.Images[frm.mlist_SmallImage.Images.Keys[i].Trim()]); }
- }
- for (int i = 0; i < frm.mlist.Count; i++)
- {
- ListViewItem lvItem = new ListViewItem();
- lvItem.Tag = frm.mlist[i].Prod_Number.Trim() + "|";
- lvItem.ImageKey = frm.mlist[i].Prod_Number.Trim();
- lvItem.Text = frm.mlist[i].Prod_Name.Trim();
- ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "数量";
- ListSubItem.Text = "1";
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "进货价格";
- ListSubItem.Text = frm.mlist[i].Prod_CostPrice.ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "销售单价";
- ListSubItem.Text = frm.mlist[i].Prod_SalesPrice.ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- //if (this.listViewData_Product.Groups.Count > 0)
- {
- if (this.tabPage2.Parent == null)
- {
- if (this.listViewData_Product.Groups[frm.mlist[i].Prod_Class] == null)
- {
- DataTable tbl = orbll.GetView_Custom("tb_ErpSystemCategory", StrWhere: "Sc_ClassCode = '" + frm.mlist[i].Prod_Class + "'", ShowColumnName: "Sc_ClassName").Tables[0];
- ListViewGroup man_lvg = new ListViewGroup();
- man_lvg.Name = frm.mlist[i].Prod_Class;
- if (tbl.Rows.Count > 0)
- { man_lvg.Header = tbl.Rows[0]["Sc_ClassName"].ToString().Trim(); }
- else
- { man_lvg.Header = "未分组"; }
- man_lvg.HeaderAlignment = HorizontalAlignment.Left;
- this.listViewData_Product.Groups.Add(man_lvg);
- }
- this.listViewData_Product.Groups[frm.mlist[i].Prod_Class].Items.Add(lvItem);
- }
- else
- {
- lvItem.Group = this.listViewData_Product.Groups["NotGroup"];
- }
- }
- this.listViewData_Product.Items.Add(lvItem);
- this.IsDataChange = true;
- }
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Product);
- }
- }
- /// <summary>
- /// 商品工具箱_服务
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnToolbox_Service_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.cmbtreev_PackageName.Text))
- { MessageBoxCustom.Show("请选择套系名称!"); return; }
- LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ToolboxListViewSamllForm frm = new DoorCityProcess.SetSmallForm.ToolboxListViewSamllForm();
- frm.LoadType = "婚庆服务";
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- for (int i = 0; i < frm.mlist_SmallImage.Images.Keys.Count; i++)
- {
- if (!this.mlistImage.Images.Keys.Contains(frm.mlist_SmallImage.Images.Keys[i].Trim()))
- { this.mlistImage.Images.Add(frm.mlist_SmallImage.Images.Keys[i].Trim(), frm.mlist_SmallImage.Images[frm.mlist_SmallImage.Images.Keys[i].Trim()]); }
- }
- for (int i = 0; i < frm.mlist.Count; i++)
- {
- ListViewItem lvItem = new ListViewItem();
- lvItem.Tag = frm.mlist[i].Prod_Number.Trim() + "|";
- lvItem.ImageKey = frm.mlist[i].Prod_Number.Trim();
- lvItem.Text = frm.mlist[i].Prod_Name.Trim();
- ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "数量";
- ListSubItem.Text = "1";
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "进货价格";
- ListSubItem.Text = frm.mlist[i].Prod_CostPrice.ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "销售单价";
- ListSubItem.Text = frm.mlist[i].Prod_SalesPrice.ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- //if (this.listViewData_Service.Groups.Count > 0)
- {
- if (this.tabPage2.Parent == null)
- {
- if (this.listViewData_Service.Groups[frm.mlist[i].Prod_Class] == null)
- {
- DataTable tbl = orbll.GetView_Custom("tb_ErpSystemCategory", StrWhere: "Sc_ClassCode = '" + frm.mlist[i].Prod_Class + "'", ShowColumnName: "Sc_ClassName").Tables[0];
- ListViewGroup man_lvg = new ListViewGroup();
- man_lvg.Name = frm.mlist[i].Prod_Class;
- if (tbl.Rows.Count > 0)
- { man_lvg.Header = tbl.Rows[0]["Sc_ClassName"].ToString().Trim(); }
- else
- { man_lvg.Header = "未分组"; }
- man_lvg.HeaderAlignment = HorizontalAlignment.Left;
- this.listViewData_Service.Groups.Add(man_lvg);
- }
- this.listViewData_Service.Groups[frm.mlist[i].Prod_Class].Items.Add(lvItem);
- }
- else
- {
- lvItem.Group = this.listViewData_Service.Groups["NotGroup"];
- }
- }
- this.listViewData_Service.Items.Add(lvItem);
- this.IsDataChange = true;
- }
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Service);
- }
- }
- /// <summary>
- /// 景点、次数工具箱
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnToolbox_Sights_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.cmbtreev_PackageName.Text))
- { MessageBoxCustom.Show("请选择套系名称!"); return; }
- LYFZ.Software.MainBusiness.InitialSet.PackagesGoods.FrmTheScenery frm = new PackagesGoods.FrmTheScenery();
- frm.StrPackagesType = this.StrPackagesType;
- if (this.TabControl.SelectedTab.Name.Trim() == "tabPage1")
- {
- #region
- frm.StrSightsType = "0";
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- for (int i = 0; i < frm.tbl_Select.Rows.Count; i++)
- {
- bool IsFind = false;
- for (int j = 0; j < this.listViewData_Sights.Items.Count; j++)
- {
- if (this.listViewData_Sights.Items[j].Text.Trim() == frm.tbl_Select.Rows[i]["Tsc_Name"].ToString().Trim())
- { IsFind = true; break; }
- }
- if (!IsFind)
- {
- ListViewItem lvItem = new ListViewItem();
- lvItem.Tag = frm.tbl_Select.Rows[i]["ID"].ToString().Trim() + "|";
- lvItem.Text = frm.tbl_Select.Rows[i]["Tsc_Name"].ToString().Trim();
- ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "服装套数";
- ListSubItem.Text = "1";
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "成本单价";
- ListSubItem.Text = frm.tbl_Select.Rows[i]["Tsc_CostPrice"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "销售单价";
- ListSubItem.Text = frm.tbl_Select.Rows[i]["Tsc_SalesPrice"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- if ((this.listViewData_Sights.Items.Count % 2) > 0)
- { lvItem.BackColor = System.Drawing.Color.PapayaWhip; }
- else
- { lvItem.BackColor = System.Drawing.Color.PowderBlue; }
- this.listViewData_Sights.Items.Add(lvItem);
- this.IsDataChange = true;
- }
- }
- }
- #endregion
- }
- else if (this.TabControl.SelectedTab.Name.Trim() == "tabPage2")
- {
- #region
- frm.StrSightsType = "1";
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- for (int i = 0; i < frm.tbl_Select.Rows.Count; i++)
- {
- bool IsFind = false;
- for (int j = 0; j < this.listViewData_Stages.Items.Count; j++)
- {
- if (this.listViewData_Stages.Items[j].Text.Trim() == frm.tbl_Select.Rows[i]["Tsc_Name"].ToString().Trim())
- { IsFind = true; break; }
- }
- if (!IsFind)
- {
- ListViewItem lvItem = new ListViewItem();
- lvItem.Tag = frm.tbl_Select.Rows[i]["ID"].ToString().Trim() + "|";
- lvItem.Text = frm.tbl_Select.Rows[i]["Tsc_Name"].ToString().Trim();
- ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "入册";
- ListSubItem.Text = "0";
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "入底";
- ListSubItem.Text = "0";
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "服装套数";
- ListSubItem.Text = "1";
- lvItem.SubItems.Add(ListSubItem);
- if ((this.listViewData_Stages.Items.Count % 2) > 0)
- { lvItem.BackColor = System.Drawing.Color.PapayaWhip; }
- else
- { lvItem.BackColor = System.Drawing.Color.PowderBlue; }
- ListViewGroup man_lvg = new ListViewGroup();
- man_lvg.Tag = lvItem.Text;
- man_lvg.Name = lvItem.Text;
- man_lvg.Header = lvItem.Text;
- man_lvg.HeaderAlignment = HorizontalAlignment.Left;
- this.listViewData_Product.Groups.Add(man_lvg);
- man_lvg = new ListViewGroup();
- man_lvg.Tag = lvItem.Text;
- man_lvg.Name = lvItem.Text;
- man_lvg.Header = lvItem.Text;
- man_lvg.HeaderAlignment = HorizontalAlignment.Left;
- this.listViewData_Service.Groups.Add(man_lvg);
- this.listViewData_Stages.Items.Add(lvItem);
- this.IsDataChange = true;
- }
- }
- }
- #endregion
- }
- }
- /// <summary>
- /// 商品删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDelete_Product_Click(object sender, EventArgs e)
- {
- if (this.listViewData_Product.Items.Count > 0 && this.listViewData_Product.SelectedItems.Count > 0)
- {
- if (MessageBoxCustom.Show("你确定要移除吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- this.listViewData_Product.Items.Remove(this.listViewData_Product.SelectedItems[0]);
- this.ListViewDrawSingleOrDoubleRows(ListViewType.套系商品);
- this.IsDataChange = true;
- this.GetSeriesCostsPriceStatistics();
- }
- }
- }
- /// <summary>
- /// 服务删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDelete_Service_Click(object sender, EventArgs e)
- {
- if (this.listViewData_Service.Items.Count > 0 && this.listViewData_Service.SelectedItems.Count > 0)
- {
- if (MessageBoxCustom.Show("你确定要移除吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- this.listViewData_Service.Items.Remove(this.listViewData_Service.SelectedItems[0]);
- this.ListViewDrawSingleOrDoubleRows(ListViewType.套系服务);
- this.IsDataChange = true;
- this.GetSeriesCostsPriceStatistics();
- }
- }
- }
- /// <summary>
- /// 景点、次数删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDelete_Sights_Click(object sender, EventArgs e)
- {
- if (this.TabControl.SelectedTab.Name.Trim() == "tabPage1")
- {
- if (this.listViewData_Sights.Items.Count > 0 && this.listViewData_Sights.SelectedItems.Count > 0)
- {
- if (MessageBoxCustom.Show("你确定要移除吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- List<ListViewItem> ListRemove = new List<ListViewItem>();
- for (int i = 0; i < this.listViewData_Sights.SelectedItems.Count; i++)
- { ListRemove.Add(this.listViewData_Sights.SelectedItems[i]); }
- for (int i = 0; i < ListRemove.Count; i++)
- { this.listViewData_Sights.Items.Remove(ListRemove[i]); }
- this.ListViewDrawSingleOrDoubleRows(ListViewType.套系景点);
- this.IsDataChange = true;
- this.GetSeriesCostsPriceStatistics();
- }
- }
- }
- else if (this.TabControl.SelectedTab.Name.Trim() == "tabPage2")
- {
- if (this.listViewData_Stages.Items.Count > 0 && this.listViewData_Stages.SelectedItems.Count > 0)
- {
- if (MessageBoxCustom.Show("你确定要移除吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- List<ListViewItem> ListRemove = new List<ListViewItem>();
- for (int i = 0; i < this.listViewData_Stages.SelectedItems.Count; i++)
- {
- for (int j = 0; j < this.listViewData_Product.Items.Count; j++)
- {
- if (this.listViewData_Product.Items[j].Group.Header.Trim() == this.listViewData_Stages.SelectedItems[i].Text.Trim())
- {
- this.listViewData_Product.Items[j].Group = this.listViewData_Product.Groups["NotGroup"];
- }
- }
- this.listViewData_Product.Groups.Remove(this.listViewData_Product.Groups[this.listViewData_Stages.SelectedItems[i].Text.Trim()]);
- for (int j = 0; j < this.listViewData_Service.Items.Count; j++)
- {
- if (this.listViewData_Service.Items[j].Group.Header.Trim() == this.listViewData_Stages.SelectedItems[i].Text.Trim())
- {
- this.listViewData_Service.Items[j].Group = this.listViewData_Service.Groups["NotGroup"];
- }
- }
- this.listViewData_Service.Groups.Remove(this.listViewData_Service.Groups[this.listViewData_Stages.SelectedItems[i].Text.Trim()]);
- ListRemove.Add(this.listViewData_Stages.SelectedItems[i]);
- }
- for (int i = 0; i < ListRemove.Count; i++)
- { this.listViewData_Stages.Items.Remove(ListRemove[i]); }
- this.ListViewDrawSingleOrDoubleRows(ListViewType.套系次数);
- this.IsDataChange = true;
- this.GetSeriesCostsPriceStatistics();
- }
- }
- }
- }
- /// <summary>
- /// 保存
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSaveed_Click(object sender, EventArgs e)
- {
- if (!string.IsNullOrEmpty(this.cmbtreev_PackageName.Text.Trim()))
- {
- if (!this.IsDataChange)
- { MessageBoxCustom.Show("没做任何修改,无须保存!"); return; }
- DateTime StrTime = SDateTime.Now;
- string StrUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- string StrPackagesName = this.cmbtreev_PackageName.Text.Trim();
- string StrPackagesClass = this.cmbtreev_PackageName.Tag.ToString().Trim();
- List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
- DataTable tblPackage = orbll.GetView_Custom("tb_ErpPackages", StrWhere: "Pak_PackagesID = '" + this.cmbtreev_PackageName.Tag.ToString().Trim() + "'", ShowColumnName: "*").Tables[0];
- if (tblPackage.Rows.Count <= 0)
- { MessageBoxCustom.Show("套系'" + this.cmbtreev_PackageName.Text.Trim() + "'不存在,可能已经被删除!"); return; }
- LYFZ.Model.Model_ErpPackagesGiftMerchandise model = null;
- DataTable tblProduct = orbll.GetView_Custom("tb_ErpPackagesGiftMerchandise", StrWhere: "Pgm_PackagesCode = '" + this.cmbtreev_PackageName.Tag.ToString().Trim() + "' And Pgm_GiveType in ('0','1')", ShowColumnName: "*").Tables[0];
- #region 商品
- for (int i = 0; i < this.listViewData_Product.Items.Count; i++)
- {
- string[] StrArray = this.listViewData_Product.Items[i].Tag.ToString().Trim().Split('|');
- if (string.IsNullOrEmpty(this.listViewData_Product.Items[i].SubItems["数量"].Text.Trim()))
- { MessageBoxCustom.Show("商品'" + this.listViewData_Product.Items[i].Text + "'的数量不能为空!"); return; }
- string strProductName = this.listViewData_Product.Items[i].Text.Trim();
- int Quantity = Convert.ToInt32(this.listViewData_Product.Items[i].SubItems["数量"].Text);
- if (!string.IsNullOrEmpty(StrArray[1].Trim()))
- {
- DataRow[] dtRow = tblProduct.Select("ID = '" + StrArray[1].Trim() + "'");
- if (dtRow.Length <= 0)
- { MessageBoxCustom.Show("此套系赠送商品已被修改过,商品'" + strProductName + "'已被删除!"); return; }
- model = pgmbll.DataRowToModel(dtRow[0]);
- model.Pgm_Quantity = Quantity;
- if (this.listViewData_Product.Items[i].Group.Tag != null)
- { model.Pgm_ProductGroupName = this.listViewData_Product.Items[i].Group.Tag.ToString().Trim(); }
- model.Pgm_UpdateDateTime = StrTime;
- model.Pgm_UpdateName = StrUserID;
- clist.Add(pgmbll.GetUpdateCommandInfo(model));
- tblProduct.Rows.Remove(dtRow[0]);
- }
- else
- {
- model = new Model.Model_ErpPackagesGiftMerchandise();
- model.Pgm_GiveType = 0;
- model.Pgm_ProductNumber = StrArray[0].Trim();
- model.Pgm_ProductName = strProductName;
- model.Pgm_Quantity = Quantity;
- model.Pgm_StageNumber = "";
- model.Pgm_StageName = "";
- model.Pgm_PackagesNumber = tblPackage.Rows[0]["Pak_PackagesClass"].ToString().Trim();
- model.Pgm_PackagesName = StrPackagesName;
- model.Pgm_PackagesCode = StrPackagesClass;
- if (this.listViewData_Product.Items[i].Group.Tag != null)
- { model.Pgm_ProductGroupName = this.listViewData_Product.Items[i].Group.Tag.ToString().Trim(); }
- model.Pgm_CreateDateTime = StrTime;
- model.Pgm_CreateName = StrUserID;
- clist.Add(pgmbll.GetAddCommandInfo(model));
- }
- }
- #endregion
- #region 服务
- for (int i = 0; i < this.listViewData_Service.Items.Count; i++)
- {
- string[] StrArray = this.listViewData_Service.Items[i].Tag.ToString().Trim().Split('|');
- if (string.IsNullOrEmpty(this.listViewData_Service.Items[i].SubItems["数量"].Text.Trim()))
- { MessageBoxCustom.Show("服务'" + this.listViewData_Service.Items[i].Text + "'的数量不能为空!"); return; }
- string strProductName = this.listViewData_Service.Items[i].Text.Trim();
- int Quantity = Convert.ToInt32(this.listViewData_Service.Items[i].SubItems["数量"].Text);
- if (!string.IsNullOrEmpty(StrArray[1].Trim()))
- {
- DataRow[] dtRow = tblProduct.Select("ID = '" + StrArray[1].Trim() + "'");
- if (dtRow.Length <= 0)
- { MessageBoxCustom.Show("此套系赠送服务已被修改过,服务'" + strProductName + "'已被删除!"); return; }
- model = pgmbll.DataRowToModel(dtRow[0]);
- model.Pgm_Quantity = Quantity;
- if (this.listViewData_Service.Items[i].Group.Tag != null)
- { model.Pgm_ProductGroupName = this.listViewData_Service.Items[i].Group.Tag.ToString().Trim(); }
- model.Pgm_UpdateDateTime = StrTime;
- model.Pgm_UpdateName = StrUserID;
- clist.Add(pgmbll.GetUpdateCommandInfo(model));
- tblProduct.Rows.Remove(dtRow[0]);
- }
- else
- {
- model = new Model.Model_ErpPackagesGiftMerchandise();
- model.Pgm_GiveType = 1;
- model.Pgm_ProductNumber = StrArray[0].Trim();
- model.Pgm_ProductName = strProductName;
- model.Pgm_Quantity = Quantity;
- model.Pgm_StageNumber = "";
- model.Pgm_StageName = "";
- model.Pgm_PackagesNumber = tblPackage.Rows[0]["Pak_PackagesClass"].ToString().Trim();
- model.Pgm_PackagesName = StrPackagesName;
- model.Pgm_PackagesCode = StrPackagesClass;
- if (this.listViewData_Service.Items[i].Group.Tag != null)
- { model.Pgm_ProductGroupName = this.listViewData_Service.Items[i].Group.Tag.ToString().Trim(); }
- model.Pgm_CreateDateTime = StrTime;
- model.Pgm_CreateName = StrUserID;
- clist.Add(pgmbll.GetAddCommandInfo(model));
- }
- }
- #endregion
- for (int i = 0; i < tblProduct.Rows.Count; i++)
- { clist.Add(pgmbll.GetDeleteCommandInfo("ID", "=", tblProduct.Rows[i]["ID"])); }
- #region 景点
- if (this.TabControl.TabPages.ContainsKey("tabPage1"))
- {
- DataTable tblSights = orbll.GetView_Custom("tb_ErpPackagesGiftMerchandise", StrWhere: "Pgm_PackagesCode = '" + this.cmbtreev_PackageName.Tag.ToString().Trim() + "' And Pgm_GiveType = '2'", ShowColumnName: "*").Tables[0];
- for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
- {
- string[] StrArray = this.listViewData_Sights.Items[i].Tag.ToString().Trim().Split('|');
- if (string.IsNullOrEmpty(this.listViewData_Sights.Items[i].SubItems["服装套数"].Text.Trim()))
- { MessageBoxCustom.Show("景点'" + this.listViewData_Sights.Items[i].Text + "'的服装套数不能为空!"); return; }
- string strProductName = this.listViewData_Sights.Items[i].Text.Trim();
- int Quantity = Convert.ToInt32(this.listViewData_Sights.Items[i].SubItems["服装套数"].Text);
- if (!string.IsNullOrEmpty(StrArray[1].Trim()))
- {
- DataRow[] dtRow = tblSights.Select("ID = '" + StrArray[1].Trim() + "'");
- if (dtRow.Length <= 0)
- { MessageBoxCustom.Show("此套系赠送景点已被修改过,景点'" + strProductName + "'已被删除!"); return; }
- model = pgmbll.DataRowToModel(dtRow[0]);
- model.Pgm_IntoRegisterQuantity = 0;
- model.Pgm_IntoBottomQuantity = 0;
- model.Pgm_Quantity = Quantity;
- model.Pgm_UpdateDateTime = StrTime;
- model.Pgm_UpdateName = StrUserID;
- clist.Add(pgmbll.GetUpdateCommandInfo(model));
- tblSights.Rows.Remove(dtRow[0]);
- }
- else
- {
- model = new Model.Model_ErpPackagesGiftMerchandise();
- model.Pgm_GiveType = 2;
- model.Pgm_ProductNumber = StrArray[0].Trim();
- model.Pgm_Quantity = Quantity;
- model.Pgm_PackagesNumber = tblPackage.Rows[0]["Pak_PackagesClass"].ToString().Trim();
- model.Pgm_ProductName = strProductName;
- model.Pgm_PackagesName = StrPackagesName;
- model.Pgm_StageNumber = "";
- model.Pgm_StageName = "";
- model.Pgm_IntoRegisterQuantity = 0;
- model.Pgm_IntoBottomQuantity = 0;
- model.Pgm_PackagesCode = StrPackagesClass;
- model.Pgm_CreateDateTime = StrTime;
- model.Pgm_CreateName = StrUserID;
- clist.Add(pgmbll.GetAddCommandInfo(model));
- }
- }
- for (int i = 0; i < tblSights.Rows.Count; i++)
- { clist.Add(pgmbll.GetDeleteCommandInfo("ID", "=", tblSights.Rows[i]["ID"])); }
- }
- #endregion
- #region 次数
- if (this.TabControl.TabPages.ContainsKey("tabPage2"))
- {
- DataTable tblStages = orbll.GetView_Custom("tb_ErpPackagesGiftMerchandise", StrWhere: "Pgm_PackagesCode = '" + this.cmbtreev_PackageName.Tag.ToString().Trim() + "' And Pgm_GiveType = '3'", ShowColumnName: "*").Tables[0];
- for (int i = 0; i < this.listViewData_Stages.Items.Count; i++)
- {
- string[] StrArray = this.listViewData_Stages.Items[i].Tag.ToString().Trim().Split('|');
- if (string.IsNullOrEmpty(this.listViewData_Stages.Items[i].SubItems["服装套数"].Text.Trim()))
- { MessageBoxCustom.Show("次数'" + this.listViewData_Stages.Items[i].Text + "'的服装套数不能为空!"); return; }
- int IntoRegisterQuantity = 0;
- if (!string.IsNullOrEmpty(this.listViewData_Stages.Items[i].SubItems["入册"].Text.Trim()))
- { IntoRegisterQuantity = Convert.ToInt32(this.listViewData_Stages.Items[i].SubItems["入册"].Text.Trim()); }
- int IntoBottomQuantity = 0;
- if (!string.IsNullOrEmpty(this.listViewData_Stages.Items[i].SubItems["入底"].Text.Trim()))
- { IntoBottomQuantity = Convert.ToInt32(this.listViewData_Stages.Items[i].SubItems["入底"].Text.Trim()); }
- string strProductName = this.listViewData_Stages.Items[i].Text.Trim();
- int Quantity = Convert.ToInt32(this.listViewData_Stages.Items[i].SubItems["服装套数"].Text);
- if (!string.IsNullOrEmpty(StrArray[1].Trim()))
- {
- DataRow[] dtRow = tblStages.Select("ID = '" + StrArray[1].Trim() + "'");
- if (dtRow.Length <= 0)
- { MessageBoxCustom.Show("此套系赠送次数已被修改过,次数'" + strProductName + "'已被删除!"); return; }
- model = pgmbll.DataRowToModel(dtRow[0]);
- model.Pgm_IntoRegisterQuantity = IntoRegisterQuantity;
- model.Pgm_IntoBottomQuantity = IntoBottomQuantity;
- model.Pgm_Quantity = Quantity;
- model.Pgm_UpdateDateTime = StrTime;
- model.Pgm_UpdateName = StrUserID;
- clist.Add(pgmbll.GetUpdateCommandInfo(model));
- tblStages.Rows.Remove(dtRow[0]);
- }
- else
- {
- model = new Model.Model_ErpPackagesGiftMerchandise();
- model.Pgm_GiveType = 3;
- model.Pgm_ProductNumber = StrArray[0].Trim();
- model.Pgm_Quantity = Quantity;
- model.Pgm_PackagesNumber = tblPackage.Rows[0]["Pak_PackagesClass"].ToString().Trim();
- model.Pgm_ProductName = strProductName;
- model.Pgm_PackagesName = StrPackagesName;
- model.Pgm_StageNumber = "";
- model.Pgm_StageName = "";
- model.Pgm_IntoRegisterQuantity = IntoRegisterQuantity;
- model.Pgm_IntoBottomQuantity = IntoBottomQuantity;
- model.Pgm_PackagesCode = StrPackagesClass;
- model.Pgm_CreateDateTime = StrTime;
- model.Pgm_CreateName = StrUserID;
- clist.Add(pgmbll.GetAddCommandInfo(model));
- }
- }
- for (int i = 0; i < tblStages.Rows.Count; i++)
- { clist.Add(pgmbll.GetDeleteCommandInfo("ID", "=", tblStages.Rows[i]["ID"])); }
- }
- #endregion
- int IntoRegisterQuantityPackage = 0;
- if (!string.IsNullOrEmpty(this.txtIntoRegister.Text.Trim()))
- { IntoRegisterQuantityPackage = Convert.ToInt32(this.txtIntoRegister.Text.Trim()); }
- int IntoBottomQuantityPackage = 0;
- if (!string.IsNullOrEmpty(this.txtIntoBottom.Text.Trim()))
- { IntoBottomQuantityPackage = Convert.ToInt32(this.txtIntoBottom.Text.Trim()); }
- LYFZ.Model.Model_ErpPackages modelPackages = pkbll.DataRowToModel(tblPackage.Select("Pak_PackagesID= '" + this.cmbtreev_PackageName.Tag.ToString().Trim() + "'")[0]);
- modelPackages.Pak_IntoTheArchive = IntoBottomQuantityPackage;
- modelPackages.Pak_IntoTheBook = IntoRegisterQuantityPackage;
- modelPackages.Pak_UpdateDatetime = StrTime;
- modelPackages.Pak_Update = StrUserID;
- clist.Add(pkbll.GetUpdateCommandInfo(modelPackages));
- if (clist.Count > 0)
- {
- if (MessageBoxCustom.Show("您确定要保存吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- { return; }
- if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
- {
- this.IsSaveed = true;
- this.IsDataChange = false;
- MessageBoxCustom.Show("保存成功!");
- }
- else
- { MessageBoxCustom.Show("保存失败!"); }
- }
- }
- }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnCloseed_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSet_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.InitialSet.FrmPackagesSet frm = new FrmPackagesSet();
- frm.IsShowUcNavigationTool = false;
- frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- frm.StrPackagesType = this.StrPackagesType;
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- this.listViewData_Product.Items.Clear();
- this.listViewData_Service.Items.Clear();
- this.listViewData_Sights.Items.Clear();
- this.listViewData_Stages.Items.Clear();
- this.cmbtreev_PackageName.SetTextAndTag_ValueNull();
- this.lblCostPrice.Text = "0.00";
- this.lblSalePrice.Text = "0.00";
- this.IsPackagesSet = true;
- this.IsDataChange = false;
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_PackagesCategoryAndName(this.cmbtreev_PackageName, StrParentCode: Enum.GetName(typeof(LYFZ.EnumPublic.EnumPackagesType), StrPackagesType).ToString().Trim());
- }
- }
- /// <summary>
- /// 上移
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnUp_Click(object sender, EventArgs e)
- {
- if (this.listViewData_Stages.Items.Count > 0 && this.listViewData_Stages.SelectedItems.Count > 0)
- {
- int selectionIdx = this.listViewData_Stages.SelectedIndices[0];
- if (selectionIdx > 0)
- {
- ListViewItem lvItem = new ListViewItem();
- ListViewItem.ListViewSubItem ListSubItem = null;
- for (int i = 0; i < this.listViewData_Stages.Columns.Count; i++)
- {
- if (i == 0)
- {
- lvItem.ImageKey = this.listViewData_Stages.SelectedItems[0].ImageKey;
- lvItem.Text = this.listViewData_Stages.SelectedItems[0].Text;
- lvItem.Tag = this.listViewData_Stages.SelectedItems[0].Tag;
- }
- else
- {
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = this.listViewData_Stages.Columns[i].Text.Trim();
- ListSubItem.Text = this.listViewData_Stages.SelectedItems[0].SubItems[this.listViewData_Stages.Columns[i].Text.Trim()].Text.Trim();
- lvItem.SubItems.Add(ListSubItem);
- }
- }
- //ListViewItem lvItem = new ListViewItem();
- //lvItem.Text = this.listViewData_Stages.SelectedItems[0].Text;
- //lvItem.Tag = this.listViewData_Stages.SelectedItems[0].Tag;
- //ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
- //ListSubItem.Name = "服装套数";
- //ListSubItem.Text = this.listViewData_Stages.SelectedItems[0].SubItems["服装套数"].Text.Trim();
- //lvItem.SubItems.Add(ListSubItem);
- this.listViewData_Stages.Items.Remove(this.listViewData_Stages.SelectedItems[0]);
- this.listViewData_Stages.Items.Insert(selectionIdx - 1, lvItem);
- this.listViewData_Stages.Items[selectionIdx - 1].Selected = true;
- this.ListViewDrawSingleOrDoubleRows(ListViewType.套系次数);
- this.listViewData_Stages.Select();
- }
- }
- }
- /// <summary>
- /// 下移
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDown_Click(object sender, EventArgs e)
- {
- if (this.listViewData_Stages.Items.Count > 0 && this.listViewData_Stages.SelectedItems.Count > 0)
- {
- int selectionIdx = this.listViewData_Stages.SelectedIndices[0];
- if (selectionIdx < (this.listViewData_Stages.Items.Count - 1))
- {
- ListViewItem lvItem = new ListViewItem();
- ListViewItem.ListViewSubItem ListSubItem = null;
- for (int i = 0; i < this.listViewData_Stages.Columns.Count; i++)
- {
- if (i == 0)
- {
- lvItem.ImageKey = this.listViewData_Stages.SelectedItems[0].ImageKey;
- lvItem.Text = this.listViewData_Stages.SelectedItems[0].Text;
- lvItem.Tag = this.listViewData_Stages.SelectedItems[0].Tag;
- }
- else
- {
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = this.listViewData_Stages.Columns[i].Text.Trim();
- ListSubItem.Text = this.listViewData_Stages.SelectedItems[0].SubItems[this.listViewData_Stages.Columns[i].Text.Trim()].Text.Trim();
- lvItem.SubItems.Add(ListSubItem);
- }
- }
- //ListViewItem lvItem = new ListViewItem();
- //lvItem.Text = this.listViewData_Stages.SelectedItems[0].Text;
- //lvItem.Tag = this.listViewData_Stages.SelectedItems[0].Tag;
- //ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
- //ListSubItem.Name = "服装套数";
- //ListSubItem.Text = this.listViewData_Stages.SelectedItems[0].SubItems["服装套数"].Text.Trim();
- //lvItem.SubItems.Add(ListSubItem);
- this.listViewData_Stages.Items.Remove(this.listViewData_Stages.SelectedItems[0]);
- this.listViewData_Stages.Items.Insert(selectionIdx + 1, lvItem);
- this.listViewData_Stages.Items[selectionIdx + 1].Selected = true;
- this.ListViewDrawSingleOrDoubleRows(ListViewType.套系次数);
- this.listViewData_Stages.Select();
- }
- }
- }
- /// <summary>
- /// 选择版本获取商品成本价,卖价
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void TabControl_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (!this.IsFirstLoad)
- {
- if (this.TabControl.SelectedTab != null)
- {
- if (this.TabControl.SelectedTab.Name.Trim() == "tabPage2")
- {
- this.btnDown.Visible = true;
- this.btnUp.Visible = true;
- }
- else
- {
- this.btnDown.Visible = false;
- this.btnUp.Visible = false;
- }
- this.GetSeriesCostsPriceStatistics();
- }
- }
- }
- /// <summary>
- /// 商品列表双击
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Product_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- ListViewHitTestInfo info = this.listViewData_Product.HitTest(e.X, e.Y);
- if (!string.IsNullOrEmpty(info.SubItem.Name.Trim()))
- {
- Rectangle rect = info.SubItem.Bounds;
- switch (info.SubItem.Name.Trim())
- {
- case "数量":
- this.txtText.Location = new Point(rect.Location.X + this.listViewData_Product.Location.X + 3, rect.Location.Y + this.listViewData_Product.Location.Y + this.splitContainerEx1.Location.Y + 2);
- this.txtText.Size = rect.Size;
- this.txtText.Visible = true;
- this.txtText.Tag = info.SubItem.Name.Trim() + "|Product";
- this.txtText.Text = info.SubItem.Text.Trim();
- this.txtText.Focus();
- break;
- }
- }
- }
- /// <summary>
- /// 服务列表双击
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Service_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- ListViewHitTestInfo info = this.listViewData_Service.HitTest(e.X, e.Y);
- if (!string.IsNullOrEmpty(info.SubItem.Name.Trim()))
- {
- Rectangle rect = info.SubItem.Bounds;
- switch (info.SubItem.Name.Trim())
- {
- case "数量":
- this.txtText.Location = new Point(this.splitContainerEx1.Panel1.Width + rect.Location.X + this.listViewData_Service.Location.X + 6, rect.Location.Y + this.listViewData_Service.Location.Y + this.splitContainerEx1.Location.Y + 2);
- this.txtText.Size = rect.Size;
- this.txtText.Visible = true;
- this.txtText.Tag = info.SubItem.Name.Trim() + "|Service";
- this.txtText.Text = info.SubItem.Text.Trim();
- this.txtText.Focus();
- break;
- }
- }
- }
- /// <summary>
- /// 景点列表双击
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Sights_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- ListViewHitTestInfo info = this.listViewData_Sights.HitTest(e.X, e.Y);
- if (!string.IsNullOrEmpty(info.SubItem.Name.Trim()))
- {
- Rectangle rect = info.SubItem.Bounds;
- switch (info.SubItem.Name.Trim())
- {
- case "服装套数":
- this.txtText.Location = new Point(this.splitContainerEx1.Panel1.Width + rect.Location.X + this.listViewData_Sights.Location.X + 10, rect.Location.Y + this.listViewData_Sights.Location.Y + this.splitContainerEx1.Location.Y + this.splitContainerEx2.Panel1.Height + 39);
- this.txtText.Size = rect.Size;
- this.txtText.Visible = true;
- this.txtText.Tag = info.SubItem.Name.Trim() + "|Sights";
- this.txtText.Text = info.SubItem.Text.Trim();
- this.txtText.Focus();
- break;
- }
- }
- }
- /// <summary>
- /// 次数列表双击
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Stages_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- ListViewHitTestInfo info = this.listViewData_Stages.HitTest(e.X, e.Y);
- if (!string.IsNullOrEmpty(info.SubItem.Name.Trim()))
- {
- Rectangle rect = info.SubItem.Bounds;
- switch (info.SubItem.Name.Trim())
- {
- case "入册":
- case "入底":
- case "服装套数":
- this.txtText.Location = new Point(this.splitContainerEx1.Panel1.Width + rect.Location.X + this.listViewData_Stages.Location.X + 10, rect.Location.Y + this.listViewData_Stages.Location.Y + this.splitContainerEx1.Location.Y + this.splitContainerEx2.Panel1.Height + 39);
- this.txtText.Size = rect.Size;
- this.txtText.Visible = true;
- this.txtText.Tag = info.SubItem.Name.Trim() + "|Stages";
- this.txtText.Text = info.SubItem.Text.Trim();
- this.txtText.Focus();
- break;
- }
- }
- }
- /// <summary>
- /// 商品右键
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Product_MouseDown(object sender, MouseEventArgs e)
- {
- if (e.Button == MouseButtons.Right)
- {
- LYFZ.ComponentLibrary.ContextMenuStripEx contextmenu = new ContextMenuStripEx();
- contextmenu.Name = "Source";
- contextmenu.ItemClicked += contextmenu_ItemClicked;
- //弹出操作菜单
- contextmenu.Items.Clear();
- contextmenu.Show(MousePosition.X, MousePosition.Y);
- if (this.listViewData_Product.SelectedItems.Count > 0)
- {
- ToolStripMenuItem item = null;
- for (int i = 0; i < this.listViewData_Stages.Items.Count; i++)
- {
- item = new ToolStripMenuItem();
- item.Text = this.listViewData_Stages.Items[i].Text.Trim();
- item.Name = "Grouped_Product_" + i;
- item.Tag = this.listViewData_Stages.Items[i].Text.Trim();
- contextmenu.Items.Add(item);
- }
- item = new ToolStripMenuItem();
- item.Text = "未分组";
- item.Name = "Grouped_Product_NotGroup_";
- item.Tag = "";
- contextmenu.Items.Add(item);
- if (this.listViewData_Product.SelectedItems.Count == 1)
- {
- ToolStripSeparator tools = new ToolStripSeparator();
- contextmenu.Items.Add(tools);
- item = new ToolStripMenuItem();
- item.Text = "放大(" + this.listViewData_Product.SelectedItems[0].Text.Trim() + ")";
- item.Name = "ZoomView_0";
- item.Tag = this.listViewData_Product.SelectedItems[0].Tag.ToString().Trim();
- contextmenu.Items.Add(item);
- }
- }
- contextmenu.Show();
- }
- }
- /// <summary>
- /// 服务右键
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Service_MouseDown(object sender, MouseEventArgs e)
- {
- if (e.Button == MouseButtons.Right)
- {
- LYFZ.ComponentLibrary.ContextMenuStripEx contextmenu = new ContextMenuStripEx();
- contextmenu.Name = "Source";
- contextmenu.ItemClicked += contextmenu_ItemClicked;
- //弹出操作菜单
- contextmenu.Items.Clear();
- contextmenu.Show(MousePosition.X, MousePosition.Y);
- if (this.listViewData_Service.SelectedItems.Count > 0)
- {
- ToolStripMenuItem item = null;
- for (int i = 0; i < this.listViewData_Stages.Items.Count; i++)
- {
- item = new ToolStripMenuItem();
- item.Text = this.listViewData_Stages.Items[i].Text.Trim();
- item.Name = "Grouped_Service_" + i;
- item.Tag = this.listViewData_Stages.Items[i].Text.Trim();
- contextmenu.Items.Add(item);
- }
- item = new ToolStripMenuItem();
- item.Text = "未分组";
- item.Name = "Grouped_Service_NotGroup";
- item.Tag = "";
- contextmenu.Items.Add(item);
- if (this.listViewData_Service.SelectedItems.Count == 1)
- {
- ToolStripSeparator tools = new ToolStripSeparator();
- contextmenu.Items.Add(tools);
- item = new ToolStripMenuItem();
- item.Text = "放大(" + this.listViewData_Service.SelectedItems[0].Text.Trim() + ")";
- item.Name = "ZoomView_0";
- item.Tag = this.listViewData_Service.SelectedItems[0].Tag.ToString().Trim();
- contextmenu.Items.Add(item);
- }
- }
- contextmenu.Show();
- }
- }
- /// <summary>
- /// 右键菜单选择事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void contextmenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
- {
- ToolStripItem item = e.ClickedItem;
- if (!string.IsNullOrEmpty(item.Text.Trim()))
- {
- string[] StrArrayName = item.Name.Trim().Split('_');
- switch (StrArrayName[0].Trim())
- {
- case "ZoomView":
- string[] StrArray = item.Tag.ToString().Trim().Split('|');
- DataTable tbl = orbll.GetView_Custom("tb_ErpProduct", StrWhere: "Prod_Number = '" + StrArray[0].Trim() + "'", ShowColumnName: "Prod_Thumbnail").Tables[0];
- if (tbl.Rows.Count > 0)
- {
- if (!string.IsNullOrEmpty(tbl.Rows[0]["Prod_Thumbnail"].ToString().Trim()))
- {
- LYFZ.Software.MainBusiness.InitialSet.Product.FrmProductPic frm = new InitialSet.Product.FrmProductPic();
- frm.FrmImage = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetImage(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.StringToByte(tbl.Rows[0]["Prod_Thumbnail"].ToString()));
- frm.ShowDialog();
- }
- else
- { MessageBoxCustom.Show("产品未上传相片!"); return; }
- }
- break;
- case "Grouped":
- this.IsDataChange = true;
- switch (StrArrayName[1].Trim())
- {
- case "Product":
- for (int i = 0; i < this.listViewData_Product.SelectedItems.Count; i++)
- {
- switch (StrArrayName[2].Trim())
- {
- case "NotGroup":
- this.listViewData_Product.SelectedItems[i].Group = this.listViewData_Product.Groups["NotGroup"];
- break;
- default:
- this.listViewData_Product.SelectedItems[i].Group = this.listViewData_Product.Groups[item.Text.Trim()];
- break;
- }
- }
- break;
- case "Service":
- for (int i = 0; i < this.listViewData_Service.SelectedItems.Count; i++)
- {
- switch (StrArrayName[2].Trim())
- {
- case "NotGroup":
- this.listViewData_Service.SelectedItems[i].Group = this.listViewData_Service.Groups["NotGroup"];
- break;
- default:
- this.listViewData_Service.SelectedItems[i].Group = this.listViewData_Service.Groups[item.Text.Trim()];
- break;
- }
- }
- break;
- }
- break;
- }
- }
- }
- /// <summary>
- /// 文本框控件限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtText_KeyPress(object sender, KeyPressEventArgs e)
- {
- string[] StrArray = this.txtText.Tag.ToString().Trim().Split('|');
- bool IsFind = false;
- switch (StrArray[0].Trim())
- {
- case "入册":
- case "入底":
- if (this.StrPackagesType == 0)
- {
- IsFind = true;
- if (Convert.ToString(e.KeyChar) == "-")
- {
- if (this.txtText.BaseText.SelectedText.Trim() == this.txtText.Text.Trim())
- { this.txtText.Text = ""; }
- if (this.txtText.Text.Trim().IndexOf('-') != -1)
- { e.Handled = true; }
- if (this.txtText.Text.Trim().Length > 0)
- { e.Handled = true; }
- }
- else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- else
- {
- if (!string.IsNullOrEmpty(this.txtText.Text.Trim()))
- {
- char[] chr = this.txtText.Text.Trim().ToArray();
- if (chr[0].ToString().Trim() == "-")
- {
- if (Char.IsNumber(e.KeyChar))
- {
- if (Convert.ToInt32(e.KeyChar.ToString().Trim()) != 1)
- { e.Handled = true; }
- }
- }
- }
- }
- }
- break;
- }
- if (!IsFind)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- }
- /// <summary>
- /// 文本框控件离开事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtText_Leave(object sender, EventArgs e)
- {
- string[] StrArray = this.txtText.Tag.ToString().Trim().Split('|');
- switch (StrArray[1].Trim())
- {
- case "Product":
- if (this.listViewData_Product.SelectedItems[0].SubItems[StrArray[0].Trim()].Text.Trim() != this.txtText.Text.Trim())
- {
- this.listViewData_Product.SelectedItems[0].SubItems[StrArray[0].Trim()].Text = this.txtText.Text.Trim() == "" ? "1" : this.txtText.Text;
- this.IsDataChange = true;
- this.GetSeriesCostsPriceStatistics();
- }
- break;
- case "Service":
- if (this.listViewData_Service.SelectedItems[0].SubItems[StrArray[0].Trim()].Text.Trim() != this.txtText.Text.Trim())
- {
- this.listViewData_Service.SelectedItems[0].SubItems[StrArray[0].Trim()].Text = this.txtText.Text.Trim() == "" ? "1" : this.txtText.Text;
- this.IsDataChange = true;
- this.GetSeriesCostsPriceStatistics();
- }
- break;
- case "Sights":
- if (this.listViewData_Sights.SelectedItems[0].SubItems[StrArray[0].Trim()].Text.Trim() != this.txtText.Text.Trim())
- {
- this.listViewData_Sights.SelectedItems[0].SubItems[StrArray[0].Trim()].Text = this.txtText.Text.Trim() == "" ? "1" : this.txtText.Text;
- this.IsDataChange = true;
- this.GetSeriesCostsPriceStatistics();
- }
- break;
- case "Stages":
- if (this.listViewData_Stages.SelectedItems[0].SubItems[StrArray[0].Trim()].Text.Trim() != this.txtText.Text.Trim())
- {
- this.listViewData_Stages.SelectedItems[0].SubItems[StrArray[0].Trim()].Text = this.txtText.Text.Trim() == "" ? "1" : this.txtText.Text;
- this.IsDataChange = true;
- this.GetSeriesCostsPriceStatistics();
- }
- break;
- }
- this.txtText.Visible = false;
- }
- /// <summary>
- /// 入册
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtIntoRegister_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- if (!e.Handled)
- { this.IsDataChange = true; }
- }
- /// <summary>
- /// 入底
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtIntoBottom_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (this.StrPackagesType == 0)
- {
- if (Convert.ToString(e.KeyChar) == "-")
- {
- if (this.txtIntoBottom.BaseText.SelectedText.Trim() == this.txtIntoBottom.Text.Trim())
- { this.txtIntoBottom.Text = ""; }
- if (this.txtIntoBottom.Text.Trim().IndexOf('-') != -1)
- { e.Handled = true; }
- if (this.txtIntoBottom.Text.Trim().Length > 0)
- { e.Handled = true; }
- }
- else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- else
- {
- if (!string.IsNullOrEmpty(this.txtIntoBottom.Text.Trim()))
- {
- char[] chr = this.txtIntoBottom.Text.Trim().ToArray();
- if (chr[0].ToString().Trim() == "-")
- {
- if (Char.IsNumber(e.KeyChar))
- {
- if (Convert.ToInt32(e.KeyChar.ToString().Trim()) != 1)
- { e.Handled = true; }
- }
- }
- }
- }
- }
- else
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- if (!e.Handled)
- { this.IsDataChange = true; }
- }
- /// <summary>
- /// 窗体关闭前
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void PackagesGoodsSetFormMain_FormClosing(object sender, FormClosingEventArgs e)
- {
- if (!this.IsSaveed)
- {
- if (this.IsPackagesSet)
- { this.IsSaveed = this.IsPackagesSet; }
- }
- }
- #region
- /// <summary>
- /// 获取套系成本统计
- /// </summary>
- void GetSeriesCostsPriceStatistics()
- {
- decimal CostPrice = 0;
- decimal SalePrice = 0;
- if (this.TabControl.SelectedTab.Name.Trim() == "tabPage1")
- {
- this.GetProductPrice(ref CostPrice, ref SalePrice);
- this.GetServicePrice(ref CostPrice, ref SalePrice);
- this.GetSightsPrice(ref CostPrice, ref SalePrice);
- this.lblCostPrice.Text = Convert.ToDecimal(CostPrice).ToString("N2");
- this.lblSalePrice.Text = Convert.ToDecimal(SalePrice).ToString("N2");
- }
- else
- {
- this.GetProductPrice(ref CostPrice, ref SalePrice);
- this.GetServicePrice(ref CostPrice, ref SalePrice);
- this.lblCostPrice.Text = Convert.ToDecimal(CostPrice).ToString("N2");
- this.lblSalePrice.Text = Convert.ToDecimal(SalePrice).ToString("N2");
- }
- ////儿童与婚纱区分版本
- ////版本判断
- //switch (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
- //{
- // case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版:
- // this.GetProductPrice(ref CostPrice, ref SalePrice);
- // this.GetServicePrice(ref CostPrice, ref SalePrice);
- // this.lblCostPrice.Text = Convert.ToDecimal(CostPrice).ToString("N2");
- // this.lblSalePrice.Text = Convert.ToDecimal(SalePrice).ToString("N2");
- // break;
- // default:
- // this.GetProductPrice(ref CostPrice, ref SalePrice);
- // this.GetServicePrice(ref CostPrice, ref SalePrice);
- // this.GetSightsPrice(ref CostPrice, ref SalePrice);
- // this.lblCostPrice.Text = Convert.ToDecimal(CostPrice).ToString("N2");
- // this.lblSalePrice.Text = Convert.ToDecimal(SalePrice).ToString("N2");
- // break;
- //}
- }
- decimal ConvertToDecimal(object obj)
- {
- try
- {
- if (obj != null && !string.IsNullOrEmpty(obj.ToString()))
- {
- decimal outdec = 0.00m;
- decimal.TryParse(obj.ToString().Trim(), out outdec);
- return outdec;
- }
- else
- {
- return 0.00m;
- }
- }
- catch {
- return 0.00m;
- }
- }
- /// <summary>
- /// 获取商品成本价
- /// </summary>
- /// <param name="CostPrice"></param>
- /// <param name="SalesPrice"></param>
- void GetProductPrice(ref decimal CostPrice, ref decimal SalesPrice)
- {
- for (int i = 0; i < this.listViewData_Product.Items.Count; i++)
- {
- CostPrice += ConvertToDecimal(this.listViewData_Product.Items[i].SubItems["数量"].Text.Trim()) * ConvertToDecimal(this.listViewData_Product.Items[i].SubItems["进货价格"].Text.Trim());
- SalesPrice += ConvertToDecimal(this.listViewData_Product.Items[i].SubItems["数量"].Text.Trim()) * ConvertToDecimal(this.listViewData_Product.Items[i].SubItems["销售单价"].Text.Trim());
- }
-
- }
- /// <summary>
- /// 获取服务成本价
- /// </summary>
- /// <param name="CostPrice"></param>
- /// <param name="SalesPrice"></param>
- void GetServicePrice(ref decimal CostPrice, ref decimal SalesPrice)
- {
- for (int i = 0; i < this.listViewData_Service.Items.Count; i++)
- {
- CostPrice += ConvertToDecimal(this.listViewData_Service.Items[i].SubItems["数量"].Text.Trim()) * ConvertToDecimal(this.listViewData_Service.Items[i].SubItems["进货价格"].Text.Trim());
- SalesPrice += ConvertToDecimal(this.listViewData_Service.Items[i].SubItems["数量"].Text.Trim()) * ConvertToDecimal(this.listViewData_Service.Items[i].SubItems["销售单价"].Text.Trim());
- }
- }
- /// <summary>
- /// 获取景点成本价
- /// </summary>
- /// <param name="CostPrice"></param>
- /// <param name="SalesPrice"></param>
- void GetSightsPrice(ref decimal CostPrice, ref decimal SalesPrice)
- {
- for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
- {
- CostPrice += ConvertToDecimal(this.listViewData_Sights.Items[i].SubItems["成本单价"].Text.Trim());
- SalesPrice += ConvertToDecimal(this.listViewData_Sights.Items[i].SubItems["销售单价"].Text.Trim());
- }
- }
- /// <summary>
- /// 绘制列表单双行
- /// </summary>
- /// <param name="ProcessType"></param>
- void ListViewDrawSingleOrDoubleRows(ListViewType ProcessType)
- {
- if (ProcessType == ListViewType.套系商品)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Product);
- }
- else if (ProcessType == ListViewType.套系服务)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Service);
- }
- else if (ProcessType == ListViewType.套系景点)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Sights);
- }
- else if (ProcessType == ListViewType.套系次数)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Stages);
- }
- }
- #endregion
- enum ListViewType
- {
- 套系商品,
- 套系服务,
- 套系景点,
- 套系次数
- }
- }
- }
|