using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Text;
|
using System.Windows.Forms;
|
|
namespace WarM
|
{
|
public partial class Sc_POSumReportByCusDlg : Form
|
{
|
public Sc_POSumReportByCusDlg()
|
{
|
InitializeComponent();
|
}
|
public int IsOk;
|
public string sDlgWhere = "";
|
|
//³õʼ»¯GRID
|
private void initGrid()
|
{
|
grdSell.RowTemplate.Height = 18;
|
grdSell.RowTemplate.MinimumHeight = 18;
|
grdSell.ColumnHeadersHeight = 40;
|
grdSell.RowHeadersVisible = false;
|
grdSell.ColumnHeadersVisible = true;
|
//¸ñʽ»¯
|
//±í¸ñÉèÖÃ
|
grdSell.RowsDefaultCellStyle.SelectionForeColor = Color.White;
|
grdSell.RowsDefaultCellStyle.SelectionBackColor = Color.DarkCyan;
|
grdSell.DefaultCellStyle.SelectionBackColor = Color.DarkCyan;
|
grdSell.DefaultCellStyle.SelectionForeColor = Color.White;
|
grdSell.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
|
grdSell.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
grdSell.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
grdSell.ReadOnly = true;
|
grdSell.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; //ÔÊÐíÓû§µ÷ÕûÁпí
|
grdSell.EnableHeadersVisualStyles = false; //Íø¸ñ±êÌâ Ñùʽ
|
grdSell.AllowUserToAddRows = false; //ÊÇ·ñÔÊÐí×ÔÔö--·ñ
|
grdSell.AllowUserToDeleteRows = false; //ÊÇ·ñÔÊÐíɾ³ý--·ñ
|
grdSell.AllowUserToResizeColumns = true; //ÔÊÐíµ÷ÕûÁпí--ÊÇ
|
grdSell.AllowUserToResizeRows = false; //ÔÊÐíµ÷ÕûÐиß--·ñ
|
grdSell.AllowUserToOrderColumns = true; //ÔÊÐí ÍÏ×§ÁÐ
|
grdSell.BackgroundColor = Color.White;
|
grdSell.GridColor = Color.LightGray; //Íø¸ñÏßÑÕÉ«
|
grdSell.ShowCellToolTips = true;
|
grdSell.CellBorderStyle = DataGridViewCellBorderStyle.RaisedVertical;
|
grdSell.AlternatingRowsDefaultCellStyle.BackColor = Color.Lavender;
|
grdSell.ColumnHeadersDefaultCellStyle.BackColor = Color.LightGray;
|
//
|
DBUtility.ClsPub.GetGridView(grdSell, this.Name + "grdSell", DBUtility.ClsPub.AppPath);//ÉèÖÃÁпí
|
|
|
grdWh.RowTemplate.Height = 18;
|
grdWh.RowTemplate.MinimumHeight = 18;
|
grdWh.ColumnHeadersHeight = 40;
|
grdWh.RowHeadersVisible = false;
|
grdWh.ColumnHeadersVisible = true;
|
//¸ñʽ»¯
|
//±í¸ñÉèÖÃ
|
grdWh.RowsDefaultCellStyle.SelectionForeColor = Color.White;
|
grdWh.RowsDefaultCellStyle.SelectionBackColor = Color.DarkCyan;
|
grdWh.DefaultCellStyle.SelectionBackColor = Color.DarkCyan;
|
grdWh.DefaultCellStyle.SelectionForeColor = Color.White;
|
grdWh.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
|
grdWh.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
grdWh.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
grdWh.ReadOnly = true;
|
grdWh.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; //ÔÊÐíÓû§µ÷ÕûÁпí
|
grdWh.EnableHeadersVisualStyles = false; //Íø¸ñ±êÌâ Ñùʽ
|
grdWh.AllowUserToAddRows = false; //ÊÇ·ñÔÊÐí×ÔÔö--·ñ
|
grdWh.AllowUserToDeleteRows = false; //ÊÇ·ñÔÊÐíɾ³ý--·ñ
|
grdWh.AllowUserToResizeColumns = true; //ÔÊÐíµ÷ÕûÁпí--ÊÇ
|
grdWh.AllowUserToResizeRows = false; //ÔÊÐíµ÷ÕûÐиß--·ñ
|
grdWh.AllowUserToOrderColumns = true; //ÔÊÐí ÍÏ×§ÁÐ
|
grdWh.BackgroundColor = Color.White;
|
grdWh.GridColor = Color.LightGray; //Íø¸ñÏßÑÕÉ«
|
grdWh.ShowCellToolTips = true;
|
grdWh.CellBorderStyle = DataGridViewCellBorderStyle.RaisedVertical;
|
grdWh.AlternatingRowsDefaultCellStyle.BackColor = Color.Lavender;
|
grdWh.ColumnHeadersDefaultCellStyle.BackColor = Color.LightGray;
|
//
|
//
|
DBUtility.ClsPub.GetGridView(grdWh, this.Name + "grdWh", DBUtility.ClsPub.AppPath);//ÉèÖÃÁпí
|
|
}
|
|
//ÏÔʾÁбí
|
private void Display_Sell()
|
{
|
SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN();
|
DataSet DSet;
|
string sSql = "";
|
string sWhere = "";
|
long HParentID = 0;
|
//Ê÷Ðνڵã
|
|
//¹ýÂËÌõ¼þ
|
sSql = "select hitemid,hnumber ±àÂë,hname µ¥¾ÝÃû³Æ from Gy_PoStockStyle where HStopflag=0 order by hnumber";
|
//Ö´ÐÐSQL
|
DSet = SubCn.RunProcReturn(sSql, "Gy_PoStockStyle");
|
//Éú³ÉÊ×ÐбêÌâ
|
if (DSet == null)
|
{
|
return;
|
}
|
//
|
for (int i = 0; i < grdSell.ColumnCount; i++)
|
{
|
grdSell.Columns[i].Frozen = false;
|
}
|
//
|
grdSell.DataSource = DSet.Tables[0].DefaultView;
|
if (DSet.Tables[0] != null && DSet.Tables[0].Rows.Count > 0)
|
{
|
this.grdSell.Rows[0].Selected = false;
|
}
|
//ÉèÖúϼÆÁÐ new
|
//string sTotalCol = "";
|
//sTotalCol = ClsPub.GetTotalCols(DSet);
|
//string[] sT;
|
//sT = sTotalCol.Split(Convert.ToChar(","));
|
//oSumGrid.BuildTotalCols(sT);
|
//
|
//ºÏ¼Æ
|
//grdSell.Rows.Add();
|
|
//¼ÓÔØÁпí,Òþ²ØÁÐ
|
for (int i = 0; i < grdSell.ColumnCount; i++)
|
{
|
grdSell.Columns[i].Width = 100;
|
//if (frmCondition.cmbHComplete.Text == "·ñ")
|
//{
|
// grdSell.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
|
//}
|
//else
|
//{
|
grdSell.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic;
|
//}
|
|
if (grdSell.Columns[i].HeaderText.Substring(0, 1).ToLower() == "h")
|
{
|
grdSell.Columns[i].Visible = false;
|
}
|
else
|
{
|
grdSell.Columns[i].Visible = true;
|
}
|
}
|
DBUtility.ClsPub.GetGridView(this.grdSell, this.Name + "grdSell", DBUtility.ClsPub.AppPath);
|
}
|
|
//ÏÔʾÁбí
|
private void Display_Wh()
|
{
|
SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN();
|
DataSet DSet;
|
string sSql = "";
|
string sWhere = "";
|
long HParentID = 0;
|
//Ê÷Ðνڵã
|
|
//¹ýÂËÌõ¼þ
|
sSql = "select hitemid,hnumber ²Ö¿â±àÂë,hname ²Ö¿âÃû³Æ from Gy_Warehouse where HStopflag=0 and HEndflag<>0 order by hnumber";
|
//Ö´ÐÐSQL
|
DSet = SubCn.RunProcReturn(sSql, "Gy_Warehouse");
|
//Éú³ÉÊ×ÐбêÌâ
|
if (DSet == null)
|
{
|
return;
|
}
|
//
|
for (int i = 0; i < grdWh.ColumnCount; i++)
|
{
|
grdWh.Columns[i].Frozen = false;
|
}
|
//
|
grdWh.DataSource = DSet.Tables[0].DefaultView;
|
if (DSet.Tables[0] != null && DSet.Tables[0].Rows.Count > 0)
|
{
|
this.grdWh.Rows[0].Selected = false;
|
}
|
//ÉèÖúϼÆÁÐ new
|
//string sTotalCol = "";
|
//sTotalCol = ClsPub.GetTotalCols(DSet);
|
//string[] sT;
|
//sT = sTotalCol.Split(Convert.ToChar(","));
|
//oSumGrid.BuildTotalCols(sT);
|
//
|
//ºÏ¼Æ
|
//grdWh.Rows.Add();
|
|
//¼ÓÔØÁпí,Òþ²ØÁÐ
|
for (int i = 0; i < grdWh.ColumnCount; i++)
|
{
|
grdWh.Columns[i].Width = 100;
|
//if (frmCondition.cmbHComplete.Text == "·ñ")
|
//{
|
// grdWh.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
|
//}
|
//else
|
//{
|
grdWh.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic;
|
//}
|
|
if (grdWh.Columns[i].HeaderText.Substring(0, 1).ToLower() == "h")
|
{
|
grdWh.Columns[i].Visible = false;
|
}
|
else
|
{
|
grdWh.Columns[i].Visible = true;
|
}
|
}
|
DBUtility.ClsPub.GetGridView(this.grdWh, this.Name + "grdWh", DBUtility.ClsPub.AppPath);
|
}
|
|
private Int32 Fun_GetCol(string sCol, DataGridView grd)
|
{
|
return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grd);
|
}
|
|
private void cmdHBSupID_Click(object sender, EventArgs e)
|
{
|
BLL.ClsBaseSelect.SetTextByCus(txtHCusID);
|
}
|
|
private void cmdCancel_Click(object sender, EventArgs e)
|
{
|
IsOk = 2;
|
this.Visible = false;
|
}
|
|
private void cmdOK_Click(object sender, EventArgs e)
|
{
|
DBUtility.Gy_BaseFun.SaveControlInfo(groupBox2, this.Name);
|
if (Sub_GetDlgWhere() == false)
|
{
|
return;
|
}
|
IsOk = 1;
|
this.Visible = false;
|
}
|
|
private void Sc_POSumReportByCusDlg_Activated(object sender, EventArgs e)
|
{
|
IsOk = 0;
|
}
|
|
private void Sc_POSumReportByCusDlg_Load(object sender, EventArgs e)
|
{
|
dtpHBDate.Value = DateTime.Today.AddDays(-90);
|
//dtpHEDate.Value = DateTime.Today;
|
//cmbHSumType.SelectedIndex = 0;
|
DBUtility.Gy_BaseFun.GetControlInfo(groupBox2, this.Name);
|
//cmbHType.SelectedIndex = 0;
|
initGrid();
|
Display_Sell();
|
Display_Wh();
|
}
|
|
private void chkHSumFlag_CheckedChanged(object sender, EventArgs e)
|
{
|
//if (chkHSumFlag.Checked)
|
//{
|
// lblHSumType.Visible = true;
|
// cmbHSumType.Visible = true ;
|
//}
|
//else
|
//{
|
// lblHSumType.Visible = false;
|
// cmbHSumType.Visible = false;
|
//}
|
}
|
|
|
//¿ìËÙ¹ýÂË
|
private bool Sub_GetDlgWhere()
|
{
|
string sFastSQL = "";
|
//ÅжϿªÊ¼ÈÕÆÚ
|
sFastSQL = sFastSQL + "'" + dtpHBDate.Value.ToShortDateString() + "' ";
|
sFastSQL = sFastSQL + ",'" + dtpHEDate.Value.ToShortDateString() + "' ";
|
|
//ÍùÀ´µ¥Î»
|
sFastSQL = sFastSQL + "," + DBUtility.ClsPub.isLong ( txtHCusID.Tag) + "";
|
|
//ÏúÊÛ·½Ê½
|
if (grdSell.SelectedRows.Count > 0)
|
{
|
sFastSQL = sFastSQL + " ";
|
string s = "";
|
for (int i = 0; i < grdSell.SelectedRows.Count; i++)
|
{
|
s = s + "," + DBUtility.ClsPub.isLong(grdSell.Rows[grdSell.SelectedRows[i].Index].Cells[0].Value).ToString();
|
}
|
sFastSQL = sFastSQL + ",'" + s.Substring(1, s.Length - 1) + "'";
|
}
|
else
|
{
|
MessageBox.Show("ÇëÑ¡Ôñ²É¹º·½Ê½£¡");
|
return false;
|
}
|
//²Ö¿â
|
if (grdWh.SelectedRows.Count > 0)
|
{
|
sFastSQL = sFastSQL + " ";
|
string s2 = "";
|
for (int i = 0; i < grdWh.SelectedRows.Count; i++)
|
{
|
s2 = s2 + "," + DBUtility.ClsPub.isLong(grdWh.Rows[grdWh.SelectedRows[i].Index].Cells[0].Value).ToString();
|
}
|
sFastSQL = sFastSQL + ",'" + s2.Substring(1, s2.Length - 1) + "'";
|
}
|
else
|
{
|
MessageBox.Show("ÇëÑ¡Ôñ²Ö¿â£¡");
|
return false;
|
}
|
|
|
if (sFastSQL.Trim() == "")
|
{
|
MessageBox.Show("ûÓÐÊäÈëÌõ¼þ!");
|
return false;
|
}
|
sDlgWhere = sFastSQL;
|
return true;
|
}
|
|
private void txtHCusID_TextChanged(object sender, EventArgs e)
|
{
|
|
if (txtHCusID.Text.Trim() == "")
|
{
|
txtHCusID.Tag = "0";
|
}
|
}
|
|
private void txtHCusID_KeyDown(object sender, KeyEventArgs e)
|
{
|
if (e.KeyCode == Keys.Enter)
|
{
|
//»ñÈ¡¿Ø¼þλÖÃ
|
int x = 0; int y = 0;
|
BLL.ClsPub_BLL.SetXY(this, groupBox2, txtHCusID, ref x, ref y);
|
//Ñ¡Ôñ»ù´¡
|
BLL.ClsBaseDownSelect.SetTextByCustomer(txtHCusID, x, y);
|
}
|
}
|
|
|
|
|
|
|
|
|
|
|
}
|
}
|