| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- 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;
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- namespace Core.StlMes.Client.GlBusiness
- {
- public partial class FrmSlmGlAccrued : FrmBase
- {
- public FrmSlmGlAccrued()
- {
- InitializeComponent();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "doQuery":
- doQuery();
- break;
- //case "doAdd":
- // doAdd();
- // break;
- case "doAddInvoices":
- doAddInvoices();
- break;
- case "doAddFreight":
- doAddFreight();
- break;
- case "doUpdate":
- doUpdate();
- break;
- case "doReset":
- doReset();
- break;
- case "doDelete":
- doDelete();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private string setCreateTimeStart(Object value)
- {
- DateTime time = Convert.ToDateTime(value);
- DateTime endtime = new DateTime(time.Year, time.Month, time.Day, 0, 0, 0);
- endtime.ToLongTimeString();
- return endtime.ToString();
- }
- private string setCreateTimeEnd(Object value)
- {
- DateTime time = Convert.ToDateTime(value);
- DateTime endtime = new DateTime(time.Year, time.Month, time.Day, 23, 59, 59);
- return endtime.ToString();
- }
- /// <summary>
- /// 查询
- /// </summary>
- public void doQuery()
- {
- this.dataTable1.Clear();
- ArrayList parm = new ArrayList();
- parm.Add(txt_balanceNo.Text.Trim());
- parm.Add(txt_orderNo.Text.Trim());
- if (QcreateTime_Begin.Value != null)//创建开始时间
- {
- parm.Add(setCreateTimeStart(QcreateTime_Begin.Value));
- }
- if (QcreateTime_End.Value != null)//创建结束时间
- {
- parm.Add(setCreateTimeEnd(QcreateTime_End.Value));
- }
- parm.Add(cbxBALANCE_TYPE.Value.ToString());
- DataTable dt = ServerHelper.GetData("com.steering.pss.glbusiness.SlmGlAccrued.doQuery", new Object[] { parm }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
- double ysPrice = 0;
- double yfPrice = 0;
- double sumYsPrice = 0;
- double sumYfPrice = 0;
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- if (ugr.Cells["BALANCE_TPYE_DESC"].Value.ToString().Trim().Equals("应收")) {
- Double.TryParse(ugr.Cells["BALNCE_TOL_PRICE"].Value.ToString().Trim(), out ysPrice);
- sumYsPrice += ysPrice;
- }
- else if (ugr.Cells["BALANCE_TPYE_DESC"].Value.ToString().Trim().Equals("应付")) {
- Double.TryParse(ugr.Cells["BALNCE_TOL_PRICE"].Value.ToString().Trim(), out yfPrice);
- sumYfPrice += yfPrice;
- }
- }
- sumPrice.Text = string.Format("{0:C}", Convert.ToDecimal(sumYsPrice - sumYfPrice));
- }
- /// <summary>
- /// 增加应收应付
- /// </summary>
- public void doAdd()
- {
- orderManage head = new orderManage();
- head.ob = this.ob;
- head.ShowDialog();
- }
- /// <summary>
- /// 增加发票
- /// </summary>
- public void doAddInvoices()
- {
- }
- /// <summary>
- /// 增加运费
- /// </summary>
- public void doAddFreight()
- {
- freightManage head = new freightManage();
- head.ob = this.ob;
- head.ShowDialog();
- }
- /// <summary>
- /// 重置
- /// </summary>
- public void doReset()
- {
- txt_balanceNo.Text = "";
- txt_orderNo.Text = "";
- cbxBALANCE_TYPE.SelectedIndex = 0;
- }
- /// <summary>
- /// 删除
- /// </summary>
- public void doDelete()
- {
- try
- {
- ultraGrid1.Update();
- if (ultraGrid1.ActiveRow == null)
- {
- MessageUtil.ShowTips("请选择需要废除的数据!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确定废除?") == DialogResult.No)
- {
- return;
- }
- ArrayList all = new ArrayList();
- //all.Add(UserInfo.GetUserID());
- all.Add(UserInfo.GetUserName());
- all.Add(ultraGrid1.ActiveRow.Cells["BALANCE_NO"].Value.ToString());
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.glbusiness.SlmGlAccrued";
- ccp.MethodName = "doDelete";
- ccp.ServerParams = new object[] { all };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1) return;
- MessageBox.Show("废除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- doQuery();
- }
- catch (System.Exception ex)
- {
- MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- /// <summary>
- /// 修改票据
- /// </summary>
- public void doUpdate()
- {
- try
- {
- this.ultraGrid1.UpdateData();
- if (ultraGrid1.ActiveRow == null)
- {
- MessageUtil.ShowTips("请选择需要修改的数据!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确定新增或修改票据?") == DialogResult.No)
- {
- return;
- }
- ArrayList all = new ArrayList();
- //all.Add(UserInfo.GetUserID());
- all.Add(ultraGrid1.ActiveRow.Cells["BILLS_KEY"].Text.ToString());
- all.Add(UserInfo.GetUserName());
- all.Add(ultraGrid1.ActiveRow.Cells["BALANCE_NO"].Value.ToString());
-
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.glbusiness.SlmGlAccrued";
- ccp.MethodName = "doUpdate";
- ccp.ServerParams = new object[] { all };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1) return;
- MessageBox.Show("操作成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- doQuery();
- }
- catch (System.Exception ex)
- {
- MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- private void FrmSlmGlPay_Load(object sender, EventArgs e)
- {
- QcreateTime_Begin.Value = DateTime.Now.AddMonths(-1);
- QcreateTime_End.Value = DateTime.Now;
- GridHelper.SetColumnsActivateAndColor(ultraGrid1.Rows.Band, "BILLS_KEY");
- cbxBALANCE_TYPE.SelectedIndex = 0;
-
- }
- }
- }
|