| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Threading;
- using System.Collections;
- using System.Reflection;
- using CoreFS.CA06;
- namespace Core.StlMes.Client.Sale.UI.Balance.BalanceAccount
- {
- public partial class FrmBalanceInvoceMgtOrgList : Core.StlMes.Client.Sale.Common.FrmStyleBase.FrmUIBase
- {
- public FrmBalanceInvoceMgtOrgList()
- {
- InitializeComponent();
- }
- private DataSet dsInvoice = new DataSet();
- private DataSet dsInvoiceDetail = null;
- private DataSet dsInvoiceSeq = new DataSet();
- private DataSet dsInvoiceList = new DataSet();
- private void initDataSource()
- {
- dsInvoice = base.GetDataSetByColumnName(this.GetGrid1DataStruct(),
- null, GetColumnAndCaption());
- this.ultraGrid1.DataSource = dsInvoice;
- dsInvoiceSeq = base.GetDataSetByColumnName(this.GetGrid2DataStruct(),
- null, GetColumnAndCaption());
- this.ultraGrid2.DataSource = dsInvoiceSeq;
- //dsInvoiceList = base.GetDataSetByColumnName(this.GetGrid3DataStruct(),
- //null, GetColumnAndCaption());
- //this.ultraGrid3.DataSource = dsInvoiceList;
- }
- private void HiddenColumn()
- {
- try
- {
- this.ultraGrid2.DisplayLayout.Bands[0].Columns[this.INVOICENO].Hidden = true;
- this.ultraGrid2.DisplayLayout.Bands[0].Columns[this.INVOICENO_SEQ].Hidden = true;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["REALINVOICENO"].Hidden = true;
- }
- catch
- { }
-
- }
- protected override List<string> GetNumberColumn()
- {
- return new List<string>(new string[] {
- "SEND_NUM",
- "MONEY",
- "WEIGHT",
- "QUANTITY",
- "ACT_WGT",
- "OUTSTOCKMNY",
- "TRANSMNY",
- "PRICE",
- "PRICE_ORG",
- "MONEY_ORG",
- });
- }
- private Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Balance.SlmBalanceInfo slmBalanceInfo = null;
- private void FrmBalanceInvoceMgt_Load(object sender, EventArgs e)
- {
- // this.ultraExpandableGroupBox2.Visible = false;
- // this.dateTimePicker1.Value = System.DateTime.Now.AddMonths(-1);
- slmBalanceInfo = new Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Balance.SlmBalanceInfo(this.ob);
- initDataSource();
- base.SetGridStyle(ref this.ultraGrid1,ref this.ultraGrid2);
- InitGrid();
- HiddenColumn();
- InitGridValue();
- }
- private void SaveRealInvoiceNo()
- {
- this.ultraGrid1.UpdateData();
- Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
- if (this.ultraGrid1.Rows.Count == 0)
- return;
- ugr = this.ultraGrid1.ActiveRow;
- if (ugr == null)
- {
- MessageBox.Show("请选择需要保存的行");
- return;
- }
- if (!IsCanBeUpdateWithDifferentPerson(ugr.Cells["INVOICEPERSON_ORG"].Value.ToString()))
- return;
- string invoiceno = ugr.Cells["INVOICENO_ORG"].Value.ToString();
- string realInvoiceNo = ugr.Cells["REALINVOICENO_ORG"].Value.ToString();
-
- if (realInvoiceNo.Length > 30)
- {
- MessageBox.Show("发票号允许最大长度30");
- return;
- }
- string errMsg = "";
- this.slmBalanceInfo.UpdateRealInvoiceNoOrg(invoiceno, realInvoiceNo, CoreFS.SA06.CoreUserInfo.UserInfo
- .GetUserName(), out errMsg);
- if (errMsg.Length == 0)
- {
- MessageBox.Show("保存成功");
- }
- }
- private void InitGrid()
- {
- System.Drawing.Color color = System.Drawing.Color.FromArgb(255, 255, 128);
- try
- {
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["REALINVOICENO_ORG"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["REALINVOICENO_ORG"].CellAppearance.BackColor = base.GetEditColor();
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["REALINVOICENO"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["REALINVOICENO"].CellAppearance.BackColor = base.GetEditColor();
- }
- catch
- {
- }
- }
- private void InitGridValue()
- {
- try
- {
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["FST_DRAWEE_UNIT"].ValueList
- = GetFstDraWeeUnit();
- }
- catch
- {
- }
- }
- private Infragistics.Win.ValueList GetFstDraWeeUnit()
- {
- Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList();
- lit.ValueListItems.Add("120601", "N/A");
- lit.ValueListItems.Add("120602", "/");
- lit.ValueListItems.Add("120603", "天津钢管集团股份有限公司");
- lit.ValueListItems.Add("120604", "天津钢管钢铁贸易有限公司");
- lit.ValueListItems.Add("120605", "天津钢管国际贸易有限公司");
- lit.ValueListItems.Add("120606", "合同结算单位");
- return lit;
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- {
- this.Query();
- break;
- }
- case "RollInv":
- {
- this.RollBackInvoiceNo();
- break;
- }
- case "Exit":
- {
-
- this.Close();
- break;
- }
- case "Save":
- {
- this.SaveRealInvoiceNo();
- break;
- }
- case "PrintInvoice":
- {
- this.PrintInvoice();
- break;
- }
- case "Credit":
- {
- this.Credit();
- break;
- }
- case "Export":
- {
- Core.StlMes.Client.Sale.Util.UtilUltraGrid.ExportGridDataToExcel(this.Text, this.ultraGrid1);
- break;
- }
- case "AddTrans":
- {
- InvoiceSignalTransMoney();
- break;
- }
- case "PrintDetail":
- {
- PrintDetail();
- break;
- }
- }
- }
- private void QueryTransMny()
- {
- string sql = GetSqlForInvoice(this.dateTimePicker1.Value,
- this.dateTimePicker2.Value);
- DataSet ds = base.ExecuteReader(sql);
- //DataSet ds = this.slmBalanceInfo.GetInvoiceSlmBalanceTransMoney(this.dateTimePicker1.Value,
- // this.dateTimePicker2.Value);
- if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
- return;
- if (this.dsInvoice == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
- {
- }
- else
- {
- foreach (DataRow dr in ds.Tables[0].Rows)
- {
- DataSet dstemp = Core.StlMes.Client.Sale.Util.UtilDataSet.GetDataSetWithRowFilter
- (dsInvoice, "INVOICENO_ORG", dr["INVOICENO_ORG"].ToString());
- try
- {
- if (dstemp.Tables[0].Rows.Count > 0)
- {
- dr.Delete();
- }
- }
- catch
- {
- }
- }
- }
- ds.AcceptChanges();
- ds.Tables[0].TableName = this.dsInvoice.Tables[0].TableName;
- this.dsInvoice.Merge(ds, false, System.Data.MissingSchemaAction.Ignore);
- this.dsInvoice.AcceptChanges();
- // ClearGrid();
- }
- private string GetSqlForInvoice(System.DateTime dtbegin, System.DateTime dtEnd)
- {
- string sql = @"
- select sum(case
- when a.money_type = '出库费' then
- a.money
- else
- 0
- end) OUTSTOCKMNY,
- sum(case
- when a.money_type = '运费' then
- a.money
- else
- 0
- end) TRANSMNY,
- max(money_type) money_type,
- sum(nvl(a.weight, 0)) weight,
- a.buyercode,
- a.buyername,
- a.inceptcorpcode,
- a.fst_drawee_unit,
- a.forecorpcode forecorpname,
- a.forecorpname forecorpcode,
- a.invoiceno_org,
- MAX(A.REALINVOICENO_ORG) REALINVOICENO_ORG,
- max(a.INVOICEPERSON_org) INVOICEPERSON_ORG,
- max(a.invoicedate_org) INVOICEDATE_ORG,
- b.customer_nm,
- b.sale_area_desc,min(a.Invoice_Sts) Invoice_Sts
- from slm_balance_transmoney a
- join slm_order_head b on a.ord_pk = b.ord_pk
- where 1=1 and a.Invoice_Sts = '0'
- and a.invoiceno_org is not null
- {0}
- group by a.buyercode,
- a.buyername,
- a.inceptcorpcode,
- a.fst_drawee_unit,
- a.forecorpcode,
- a.forecorpname,
- a.invoiceno_org,
- b.customer_nm,
- b.sale_area_desc
- ";
- string sqlCondition = Util.ConverObject.ConvertDateTimeValueToDbLanguage("invoicedate_org", dtbegin, dtEnd);
- sql = string.Format(sql, sqlCondition);
- return sql;
- }
- private void InvoiceSignalTransMoney()
- {
- DlgBox.DlgSelectInvoceTransMnyAndOutStockMny dlg
- = new Core.StlMes.Client.Sale.UI.Balance.DlgBox.DlgSelectInvoceTransMnyAndOutStockMny(this.ob);
- dlg._invocieFlag = "1";
- dlg.ShowDialog();
- ArrayList arpk = new ArrayList();
- string errMsg = "";
- if (dlg.DialogResult == DialogResult.OK)
- {
- arpk = dlg.Tranpk;
- if (arpk.Count == 0)
- return;
- this.slmBalanceInfo.MakeFirstInvoiceForTransMnyAndOutStockMoney(arpk,
- CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg);
- if (errMsg.Length == 0)
- {
- Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功");
- this.Query();
- }
- }
- }
- /// <summary>
- /// 冲减
- /// </summary>
- private void Credit()
- {
- //Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
- //Infragistics.Win.UltraWinGrid.UltraGridRow ugrc = null;
- //if (this.ultraGrid1.Rows.Count == 0)
- // return;
- //if (this.ultraGrid2.Rows.Count == 0)
- // return;
- //if (this.ultraGrid1.Rows.Count == 1)
- // this.ultraGrid1.Rows[0].Activated = true;
- //ugr = this.ultraGrid1.ActiveRow;
- //if (ugr == null)
- //{
- // Util.MessageUtil.ShowTips("请选择需要保存的行");
- // return;
- //}
- //if (this.ultraGrid5.Rows.Count == 0)
- // return;
- //if (this.ultraGrid5.Rows.Count == 1)
- // this.ultraGrid5.Rows[0].Activated = true;
- //ugrc = this.ultraGrid5.ActiveRow;
- //if (ugrc == null)
- //{
- // Util.MessageUtil.ShowTips("请选择待冲减的行");
- // return;
- //}
- //string invoiceno = ugr.Cells["INVOICENO_ORG"].Value.ToString();
- //// "WEIGHT",
- //// "MONEY",
- //double money = Util.ConverObject.ConvertToDouble(ugr.Cells["MONEY_ORG"].Value);
- //double weight = Util.ConverObject.ConvertToDouble(ugr.Cells["WEIGHT"].Value);
- //double creditMny = Util.ConverObject.ConvertToDouble(ugrc.Cells["MONEY_ORG"].Value);
- //if (creditMny >= money)
- //{
- // Util.MessageUtil.ShowError("冲减金额必须小于货款");
- // return;
- //}
- //if (weight == 0)
- //{
- // Util.MessageUtil.ShowError("只能冲减货款");
- // return;
- //}
- //if (Util.MessageUtil.ShowYesNoAndQuestion("是否确定冲减结算单?") == DialogResult.No) return;
- //double dlivPrice = (money - creditMny) / weight;
- //ArrayList list = new ArrayList();
- //string[] str = null;
- //string sub_seq = ugrc.Cells["SUB_SEQ"].Value.ToString();
- //foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugrr in this.ultraGrid2.Rows)
- //{
- // double seqmoney = dlivPrice * Util.ConverObject.ConvertToDouble(ugrr.Cells["WEIGHT"].Value);
- // str = new string[] { invoiceno, ugrr.Cells["INVOICENO_SEQ_ORG"].Value.ToString(), dlivPrice + "",
- // seqmoney +"",sub_seq};
- // list.Add(str);
- //}
- //string errMsg = "";
- //this.slmBalanceInfo.Credit(list, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg);
- //if (errMsg.Length == 0)
- //{
- // Util.MessageUtil.ShowTips("操作成功");
- //}
- //this.Query();
- }
- private void Print()
- {
- string INVOICENO = "INVOICENO_ORG";
- string errMsg = "";
- List<string> list = new List<string>();
- if (this.ultraGrid1.Rows.Count == 0)
- return;
- if (this.ultraGrid1.Rows.Count == 1)
- this.ultraGrid1.Rows[0].Selected = true;
- this.ultraGrid1.ActiveRow.Selected = true;
- String sqlCondition = "";
- double money = 0;
- string isGreaterThanZero = "0";
- // 打印包含货款和独立的出库费 or 运费,这里因为模板不一样不能一起连打
- money = Core.StlMes.Client.Sale.Util.ConverObject.ConvertToDouble(this.ultraGrid1.Selected.Rows[0].Cells["MONEY_ORG"].Value);
- if (money != 0)
- {
- isGreaterThanZero = "0";
- }
- else
- {
- isGreaterThanZero = "1";
- }
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Selected.Rows)
- {
- money = Core.StlMes.Client.Sale.Util.ConverObject.ConvertToDouble(ugr.Cells["MONEY_ORG"].Value);
- if (money != 0)
- {
- if (isGreaterThanZero == "1")
- {
- Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("单独运费和出库费不能和货款票一起打印");
- return;
- }
- }
- else
- {
- if (isGreaterThanZero == "0")
- {
- Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("单独运费和出库费不能和货款票一起打印");
- return;
- }
- }
- sqlCondition += "\'" + ugr.Cells[INVOICENO].Value.ToString() + "\'" + ",";
- list.Add(ugr.Cells[INVOICENO].Value.ToString());
- }
- string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepInvoiceTicketOrg.cpt&__bypagesize__=false" + "&invoiceno=";
- if (isGreaterThanZero == "1")
- {
- url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepInvoiceTransAndOutStockMnOrg.cpt&__bypagesize__=false" + "&invoiceno=";
- }
- sqlCondition = sqlCondition.Substring(1, sqlCondition.Length - 1);
- sqlCondition = sqlCondition.Substring(0, sqlCondition.Length - 2);
- url = url + sqlCondition;
- Core.StlMes.Client.SaleOrder.ReviewForm.FrmOrderRepExcel
- fBug = new Core.StlMes.Client.SaleOrder.ReviewForm.FrmOrderRepExcel(this.ob, url);
- fBug.AutoSize = true;
- fBug.Text = "打印结算单";
- fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fBug.WindowState = FormWindowState.Maximized;
- fBug.Show();
- }
- private void PrintDetail()
- {
- string INVOICENO = "INVOICENO_ORG";
- string errMsg = "";
- List<string> list = new List<string>();
- if (this.ultraGrid1.Rows.Count == 0)
- return;
- if (this.ultraGrid1.Rows.Count == 1)
- this.ultraGrid1.Rows[0].Selected = true;
- this.ultraGrid1.ActiveRow.Selected = true;
- String sqlCondition = "";
- double money = 0;
-
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Selected.Rows)
- {
- sqlCondition += "\'" + ugr.Cells[INVOICENO].Value.ToString() + "\'" + ",";
- list.Add(ugr.Cells[INVOICENO].Value.ToString());
- }
- string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepInvoiceTicketOrgAtta.cpt&__bypagesize__=false" + "&invoiceno=";
-
- sqlCondition = sqlCondition.Substring(1, sqlCondition.Length - 1);
- sqlCondition = sqlCondition.Substring(0, sqlCondition.Length - 2);
- url = url + sqlCondition;
- Core.StlMes.Client.SaleOrder.ReviewForm.FrmOrderRepExcel
- fBug = new Core.StlMes.Client.SaleOrder.ReviewForm.FrmOrderRepExcel(this.ob, url);
- fBug.AutoSize = true;
- fBug.Text = "打印结算单明细";
- fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fBug.WindowState = FormWindowState.Maximized;
- fBug.Show();
- }
- private void PrintInvoice()
- {
- Print();
- return;
- string INVOICENO = "INVOICENO_ORG";
- List<string> list = new List<string>();
- if (this.ultraGrid1.Rows.Count == 0)
- return;
- if (this.ultraGrid1.Rows.Count == 1)
- this.ultraGrid1.Rows[0].Selected = true;
- this.ultraGrid1.ActiveRow.Selected = true;
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Selected.Rows)
- {
- list.Add(ugr.Cells[INVOICENO].Value.ToString());
- }
- DlgInvoicePrint print = null;
- print = new DlgInvoicePrint(this.ob);
-
- print.listInvoiceNo = list;
- print.isOrgInvoice = true;
- print.ShowDialog();
- }
- private DataSet GetTransMnyByInvoiceNo(string invoiceno)
- {
- string sql = @"select sum(a.money) money,sum(a.weight) weight,a.money_type,a.invoiceno_org
- from slm_balance_transmoney a where invoiceno_org = '{0}' and a.invoiceno_org is not null
- group by a.money_type,a.invoiceno_org";
- sql = string.Format(sql, invoiceno);
- DataSet ds = base.ExecuteReader(sql);
- return ds;
- }
- private void SetTransMoneyAndOutStockMoney()
- {
- if (this.dsInvoice == null || this.dsInvoice.Tables.Count == 0 || this.dsInvoice.Tables[0].Rows.Count == 0)
- return;
- foreach (DataRow dri in this.dsInvoice.Tables[0].Rows)
- {
- try
- {
- string invoiceno = dri[this.INVOICENO].ToString();
- DataSet ds = GetTransMnyByInvoiceNo(invoiceno);
- //DataSet ds = this.slmBalanceInfo.GetInvoiceSlmBalanceTransMoneyAndOutStockMoney(this.dateTimePicker1.Value,
- // this.dateTimePicker2.Value);
- if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
- continue;
- foreach (DataRow drd in ds.Tables[0].Rows)
- {
- if (drd["MONEY_TYPE"].ToString() == "运费")
- {
- dri["TRANSMNY"] = drd["MONEY"];
- }
- if (drd["MONEY_TYPE"].ToString() == "出库费")
- {
- dri["OUTSTOCKMNY"] = drd["MONEY"];
- }
- }
- }
- catch
- { }
- }
- this.dsInvoice.AcceptChanges();
- ClearGrid();
- }
- private Boolean IsCanBeUpdateWithDifferentPerson(string user)
- {
- if (user == CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName())
- {
- return true;
- }
- else
- {
- Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("只允许操作本人票据");
- return false;
- }
- }
- private void RollBackInvoiceNo()
- {
-
-
- if (this.ultraGrid1.Rows.Count == 0)
- return;
- Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow;
- if (ugr == null)
- return;
- if (!IsCanBeUpdateWithDifferentPerson(ugr.Cells["INVOICEPERSON_ORG"].Value.ToString()))
- return;
- string invoinceno = ugr.Cells[this.INVOICENO].Value.ToString();
- this.slmBalanceInfo.RollBaskInvoiceNoOrg(invoinceno, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
- ugr.Delete(false);
- this.ultraGrid1.UpdateData();
- }
- private string saleOrg_Corp = "120603";
- private string saleOrg_Gm = "120604";
- private string saleOrg_Gtm = "120605";
- private void Query()
- {
- dsInvoiceDetail = this.slmBalanceInfo.GeOrgtInvoiceSlmBalaneInfoByInvoiceBeginDateAndEndDate(this.dateTimePicker1.Value,
- this.dateTimePicker2.Value);
- //if (this.textBox3.Text.Length > 0)
- //{
- // dsInvoiceDetail = Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch(dsInvoiceDetail, "ORD_NO", this.textBox3.Text.Trim());
- //}
- // 只显示首次受票单位为国贸,钢贸,集团的数据
- try
- {
- dsInvoiceDetail = Util.UtilDataSet.GetDataSetWithRowFilter(dsInvoiceDetail, "FST_DRAWEE_UNIT",
- new string[] { saleOrg_Corp, saleOrg_Gm, saleOrg_Gtm }
- );
- }
- catch
- { }
- dsInvoiceDetail = base.GetDataSetByFilterDeptId(dsInvoiceDetail);
- //if ("120504".Equals(CustomInfo))
- dsInvoiceDetail = Util.UtilDataSet.GetDataSetWithRowFilter(dsInvoiceDetail, "supply_unit", CustomInfo);
- // 只显示未结转的
- dsInvoiceDetail = Core.StlMes.Client.Sale.Util.UtilDataSet.GetDataSetWithRowFilter(dsInvoiceDetail, "INVOICE_STS", "0");
- DataSet ds = Util.UtilDataSet.GetDateSetByGroupColumnAndStaticsColumnName(dsInvoiceDetail, new List<string>(GetGroupByName()),
- new List<string>(GetShowName()), new List<string>(GetStaticName()));
- Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsInvoice, ds);
- SetTransMoneyAndOutStockMoney();
- QueryTransMny();
- ClearGrid();
-
- }
- private void ClearGrid()
- {
- this.dsInvoiceSeq.Clear();
- this.dsInvoiceList.Clear();
- }
- private void QueryTransMny1()
- {
- DataSet ds = this.slmBalanceInfo.GetInvoiceSlmBalanceTransMoney(this.dateTimePicker1.Value,
- this.dateTimePicker2.Value);
- if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
- return;
- ds.Tables[0].TableName = this.dsInvoice.Tables[0].TableName;
- this.dsInvoice.Merge(ds);
- this.dsInvoice.AcceptChanges();
- }
- private void QuryGrid2(string invoiceNo)
- {
- DataSet ds2 = Util.UtilDataSet.GetDataSetWithRowFilter(dsInvoiceDetail, this.INVOICENO, invoiceNo);
- DataSet ds = Util.UtilDataSet.GetDateSetByGroupColumnAndStaticsColumnName(ds2,
- new List<string>(this.GetGrid2GroupByCol()),
- new List<string>(this.GetGrid2ShowCol()),
- new List<string>(this.GetGrid2StaticCol()));
- Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsInvoiceSeq, ds);
- }
- private void QueryGrid3(String invoiceno, string invoiceno_seq)
- {
- DataSet ds2 = Util.UtilDataSet.GetDataSetWithRowFilter(dsInvoiceDetail, this.INVOICENO, invoiceno);
- DataSet ds3 = Util.UtilDataSet.GetDataSetWithRowFilter(ds2, this.INVOICENO_SEQ, invoiceno_seq);
- Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsInvoiceList, ds3);
- }
- private string[] GetGroupByName()
- {
- return new string[]
- {
- "INVOICENO_ORG",
- // "FST_DRAWEE_UNIT",
- // "BUYERNAME",
- "FORECORPCODE"
- // "ORD_NO"
- };
- }
- private string[] GetShowName()
- {
- return new string[]
- {
- //"REMARK" ,
- // "PRICE_ORG",
- "REALINVOICENO_ORG",
- "INVOICEPERSON_ORG",
- "INVOICEDATE_ORG",
- "FST_DRAWEE_UNIT","REALINVOICENO_DATE_ORG"
- };
- }
- private string[] GetStaticName()
- {
- return new string[]
- {
- "WEIGHT",
- "MONEY_ORG"
- };
- }
- private string[] GetGrid1DataStruct()
- {
- return new string[]
- {
- "INVOICENO_ORG",
- "REALINVOICENO_ORG",
- // "REALINVOICENO_DATE_ORG",
- "FST_DRAWEE_UNIT",
- // "REALINVOICENO",
- // "BUYERNAME",
- "WEIGHT",
- "MONEY_ORG",
- "TRANSMNY",
- "OUTSTOCKMNY",
- // "TRANSMONEYQC",
- //"TRANSMONEYSY1",
- //"TRANSMONETRAIN",
- // "HOISTINGFEE",
- // "ORD_NO",
- // "REMARK",
- "FORECORPCODE",
- "INVOICEPERSON_ORG",
- "INVOICEDATE_ORG"
- }
- ;
- }
- private Hashtable GetColumnAndCaption()
- {
- return StaticData.TbColumnAndCaption.GetColumnAndCaption();
- Hashtable hs = new Hashtable();
- hs.Add("WEIGHT", "重量");
- hs.Add("INVOICENO", "结算单号");
- hs.Add("FORECORPCODE", "子公司");
- hs.Add("SHIPNO", "船号");
- hs.Add("TRANSMONEYQC", "汽运费");
- hs.Add("TRANSMONEYSY1", "船运费");
- hs.Add("TRANSMONETRAIN", "火运费");
- hs.Add("HOISTINGFEE", "吊装费");
- hs.Add("PLY", "厚/直径/壁厚");
- hs.Add("WIDTH", "宽/外径");
- hs.Add("ORD_NO", "合同号");
- hs.Add("BUYERNAME", "结算单位名称");
- hs.Add("BUYERCODE", "结算单位名称");
- hs.Add("FST_DRAWEE_UNIT", "首次受票人");
- hs.Add("STATIONCODE", "到站");
- hs.Add("MONEY_ORG", "金额");
- hs.Add("PRICE_ORG", "单价");
- hs.Add("INVOICENO_ORG", "结算单号");
- hs.Add("INVOICENO_SEQ_ORG", "序号");
- hs.Add("INVOICEPERSON_ORG", "编单人");
- hs.Add("INVOICENO_SEQ_ORG", "编单时间");
-
- return hs;
- }
- protected override Hashtable GetGridColumnLength()
- {
- return StaticData.TbColumnAndCaption.GetDataSetColumnLength();
- }
- private string[] GetGrid5DataStruct()
- {
- return new string[]
- {
- "SUBTCT_TYP",
- "SUBTCT_MOD",
- "SUBTCT_MNY",
- "SUBTCT_DSP",
- "DCL_ID",
- "DCL_DTIME",
- "REV_ID",
- "REV_DTIME",
- "REV_DSP"
- }
- ;
- }
- private string[] GetGrid2DataStruct()
- {
- return new string[]
- {
- "INVOICENO_ORG",
- "INVOICENO_SEQ_ORG",
- "ORD_NO",
- "ORD_SEQ",
- "PRICE_ORG",
- "WEIGHT",
- "MONEY_ORG",
- "SPETKEY",
- "STEELCODEKEY",
- "CATEGORY",
- "SPEC_ABBSYMNAME",
- "STD_STYLE_DESC",
- "MODEL_DESC",
- "ASKPLAN_ID"
-
- }
- ;
- }
- private string[] GetGrid2GroupByCol()
- {
- return new string[] { "INVOICENO_ORG", "INVOICENO_SEQ_ORG", "ASKPLAN_ID" };
- }
- private string[] GetGrid2ShowCol()
- {
- return GetGrid2DataStruct();
- }
- private string[] GetGrid2StaticCol()
- {
- return new string[] { "WEIGHT",
- "MONEY_ORG" };
- }
- private string[] GetGrid3DataStruct()
- {
- return new string[]
- {
-
- "SPETKEY",
- "STEELCODEKEY",
- "QUANTITY",
- "WEIGHT",
- "MONEY_ORG",
- "TRAINWAGON",
- // "SHIPNO",
- // "DOCKCODE",
- "STATIONCODE",
-
- }
- ;
- }
- private string[] GetGrid4DataStruct()
- {
- return new string[]
- {
- "SUBTCT_TYP",
- "SUBTCT_MOD",
- "SUBTCT_MNY",
- "SUBTCT_DSP",
- "SUBTCT_TIME"
-
- }
- ;
- }
- private string BUYERCODE = "BUYERCODE";
- private string ORD_NO = "ORD_NO";
- private string ORD_SEQ = "ORD_SEQ";
- private string ORD_LN_DLY = "ORD_LN_DLY";
- private string ASKPLAN_ID = "ASKPLAN_ID";
- private string ASKPLAN_ID_SEQ = "ASKPLAN_ID_SEQ";
- private string SPETKEY = "SPETKEY";
- private string STEELCODEKEY = "STEELCODEKEY";
- private string MONEY = "MONEY_ORG";
- private string WEIGHT = "WEIGHT";
- private string PRICE = "PRICE_ORG";
- private string BALANCESTATUS = "BALANCESTATUS";
- private string ADJUSTPRICEREASON = "ADJUSTPRICEREASON";
- private string INVOICENO = "INVOICENO_ORG";
- private string INVOICENO_SEQ = "INVOICENO_SEQ_ORG";
-
-
- private string BALANCESTATUS_INIT = "0";
- private string BALANCESTATUS_AFFRIM = "1";
- private string BALANCESTATUS_INVOINCE = "2";
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- if (this.ultraGrid1.Rows.Count == 0)
- return;
- Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
- if (this.ultraGrid1.Rows.Count == 1)
- ugr = this.ultraGrid1.Rows[0];
- else
- ugr = this.ultraGrid1.ActiveRow;
- string invoiceno = ugr.Cells[this.INVOICENO].Value.ToString();
- this.QuryGrid2(invoiceno);
- }
- private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
- {
- if (this.ultraGrid2.Rows.Count == 0)
- return;
- Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
- if (this.ultraGrid2.Rows.Count == 1)
- ugr = this.ultraGrid2.Rows[0];
- else
- ugr = this.ultraGrid2.ActiveRow;
- string invoiceno = ugr.Cells[this.INVOICENO].Value.ToString();
- string invoicenoseq = ugr.Cells[this.INVOICENO_SEQ].Value.ToString();
- this.QueryGrid3(invoiceno, invoicenoseq);
- }
- private void button3_Click(object sender, EventArgs e)
- {
- this.PrintInvoice();
- }
- private void ultraGrid1_AfterRowActivate_1(object sender, EventArgs e)
- {
- if (this.ultraGrid1.Rows.Count == 0)
- return;
- Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
- if (this.ultraGrid1.Rows.Count == 1)
- ugr = this.ultraGrid1.Rows[0];
- else
- ugr = this.ultraGrid1.ActiveRow;
- string invoiceno = ugr.Cells[this.INVOICENO].Value.ToString();
- this.QuryGrid2(invoiceno);
- }
- private void ultraGrid2_AfterRowActivate_1(object sender, EventArgs e)
- {
- if (this.ultraGrid2.Rows.Count == 0)
- return;
- Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
- if (this.ultraGrid2.Rows.Count == 1)
- ugr = this.ultraGrid2.Rows[0];
- else
- ugr = this.ultraGrid2.ActiveRow;
- string invoiceno = ugr.Cells[this.INVOICENO].Value.ToString();
- string invoicenoseq = ugr.Cells[this.INVOICENO_SEQ].Value.ToString();
- this.QueryGrid3(invoiceno, invoicenoseq);
- }
- }
- }
|