You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.4 KiB
74 lines
2.4 KiB
3 months ago
|
using BiskLog_Point_Of_Sale.Properties;
|
||
|
using Point_Of_Sale_Managment;
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.ComponentModel;
|
||
|
using System.Data;
|
||
|
using System.Data.SqlClient;
|
||
|
using System.Drawing;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using System.Threading.Tasks;
|
||
|
using System.Windows.Forms;
|
||
|
|
||
|
namespace BiskLog_Point_Of_Sale.Products_Module
|
||
|
{
|
||
|
public partial class RestockHistory : Form
|
||
|
{
|
||
|
SqlConnection cn;
|
||
|
SqlCommand cm, cm1;
|
||
|
DatabaseConn databasecon = new DatabaseConn();
|
||
|
SqlDataReader dr;
|
||
|
SqlTransaction transaction;
|
||
|
public RestockHistory()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
cn = new SqlConnection(databasecon.MyConnection());
|
||
|
holding2.Left = (this.ClientSize.Width - holding2.Width) / 2;
|
||
|
}
|
||
|
|
||
|
private async void RestockHistory_Load(object sender=null, EventArgs e=null)
|
||
|
{
|
||
|
Task task = new Task<int>(LoadStock);
|
||
|
holding2.Visible = true;
|
||
|
task.Start();
|
||
|
await task;
|
||
|
holding2.Visible = false;
|
||
|
}
|
||
|
|
||
|
public int LoadStock()
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
dataGridView2.Invoke(new Action(() =>
|
||
|
{
|
||
|
int i = 0;
|
||
|
dataGridView2.Rows.Clear();
|
||
|
cn.Open();
|
||
|
cm = new SqlCommand("Exec usp_restock_history @BranchID = @branch, @filter = @filter1, @From = @start, @end = @endDate", cn);
|
||
|
cm.Parameters.AddWithValue("@filter1", filterNum.Value);
|
||
|
cm.Parameters.AddWithValue("@branch", Form1.branch);
|
||
|
cm.Parameters.AddWithValue("@start", startDate.Value);
|
||
|
cm.Parameters.AddWithValue("@endDate", endDate.Value);
|
||
|
dr = cm.ExecuteReader();
|
||
|
while (dr.Read())
|
||
|
{
|
||
|
i++;
|
||
|
dataGridView2.Rows.Add(i, dr[0].ToString(), dr[1].ToString(), dr[2].ToString(), dr[3].ToString(), dr[4].ToString(),
|
||
|
Convert.ToDateTime(dr[5].ToString()).ToLongDateString(), dr[6].ToString());
|
||
|
}
|
||
|
dr.Close();
|
||
|
cn.Close();
|
||
|
dataGridView2.ClearSelection();
|
||
|
}));
|
||
|
return 1;
|
||
|
}
|
||
|
catch
|
||
|
{
|
||
|
cn.Close();
|
||
|
return 0;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|