|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
using System.Windows.Documents;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
using System.Windows.Navigation;
|
|
|
|
|
using System.Windows.Shapes;
|
|
|
|
|
|
|
|
|
|
namespace Audit.View
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// StatisticsView.xaml 的交互逻辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class StatisticsView : UserControl
|
|
|
|
|
{
|
|
|
|
|
///<Summary>
|
|
|
|
|
/// StatisticsView
|
|
|
|
|
///</Summary>
|
|
|
|
|
public StatisticsView()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string DataGridStatistics_ProductCode = null;
|
|
|
|
|
public static Boolean Button_machines_sql = false;
|
|
|
|
|
private void DataGridStatistics_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
|
|
|
|
|
{
|
|
|
|
|
int rownum = DataGridStatistics.SelectedIndex;//获取鼠标选中行并定义变量
|
|
|
|
|
if (rownum != -1)//判断鼠标定位是否有效
|
|
|
|
|
{
|
|
|
|
|
/*定位选中行及指定列单元格文本信息*/
|
|
|
|
|
DataGridStatistics_ProductCode = (DataGridStatistics.Columns[0].GetCellContent(DataGridStatistics.Items[rownum]) as TextBlock).Text;//定位第0列,原料代码
|
|
|
|
|
string DataGridStatistics_ProductName = (DataGridStatistics.Columns[1].GetCellContent(DataGridStatistics.Items[rownum]) as TextBlock).Text;//定位第1列,原料名称
|
|
|
|
|
string DataGridStatistics_unit_price = (DataGridStatistics.Columns[2].GetCellContent(DataGridStatistics.Items[rownum]) as TextBlock).Text;//定位第2列,原料名称
|
|
|
|
|
string DataGridStatistics_sum = (DataGridStatistics.Columns[3].GetCellContent(DataGridStatistics.Items[rownum]) as TextBlock).Text;//定位第3列,原料名称
|
|
|
|
|
string DataGridStatistics_total_price = (DataGridStatistics.Columns[4].GetCellContent(DataGridStatistics.Items[rownum]) as TextBlock).Text;//定位第4列,原料名称
|
|
|
|
|
this.productname.Text = DataGridStatistics_ProductName;//填入原料名
|
|
|
|
|
this.productcode.Text = DataGridStatistics_ProductCode;//填入
|
|
|
|
|
this.productsum.Text = DataGridStatistics_sum + "KG";//填入
|
|
|
|
|
Button_machines_sql = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string query_start = null;//全局变量开始时间
|
|
|
|
|
public static string query_end = null;//全局变量结束时间
|
|
|
|
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)//打开页面执行
|
|
|
|
|
{
|
|
|
|
|
this.query_date_start.Text = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd");//填入当天时间前30天
|
|
|
|
|
this.query_date_end.Text = DateTime.Now.ToString("yyyy-MM-dd");//填入当天时间
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static int Buttontype_sql = -2;//全局变量原料类型
|
|
|
|
|
public static Boolean Button_sql = true;//全局变量按钮状态
|
|
|
|
|
private void Button_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
query_start = this.query_date_start.Text;//传递开始时间
|
|
|
|
|
query_end = this.query_date_end.Text;//传递结束时间
|
|
|
|
|
string t =DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
|
|
int query_endT = DateTime.Compare(Convert.ToDateTime(query_end), Convert.ToDateTime(t)); //比较结束时间及当期,小于-1 等于0 大于1
|
|
|
|
|
if (query_endT == 0) query_end = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"); //如果结束时间为空则填入当天时间加1天
|
|
|
|
|
if (query_end == DateTime.Now.ToString("yyyy-MM-dd")) query_end = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
|
|
|
|
|
int query_TimeCompare = DateTime.Compare(Convert.ToDateTime(query_start), Convert.ToDateTime(query_end)); //比较开始结束时间,小于-1 等于0 大于1
|
|
|
|
|
if (query_TimeCompare == 1)//判断查询时间是否有效,等于1无效
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("SC:无效查询时间", "错误");//返回无效时间弹窗
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (this.stuff_ProductType.Text == "染料") Buttontype_sql = 0;//原料类型0。染料,1助剂,2粉体
|
|
|
|
|
if (this.stuff_ProductType.Text == "助剂") Buttontype_sql = 1;
|
|
|
|
|
if (this.stuff_ProductType.Text == "粉体助剂") Buttontype_sql = 2;
|
|
|
|
|
if (this.stuff_ProductType.Text == "液体染料") Buttontype_sql = 3;
|
|
|
|
|
if (this.stuff_ProductType.Text == "全部原料") Buttontype_sql = -1;
|
|
|
|
|
Button_sql = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DataGridStatistics_Copy_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|