You are on page 1of 13

‫لیستی پیشاندانی خەرجی‬

namespace Super_Market_Cc
{
public partial class Frm_Xarci : Form
{
DataTable DaTe = new DataTable();
Class_Xarcy CX = new Class_Xarcy();

public Frm_Xarci()
{
InitializeComponent();
Data_Preview();
View_All_Xarcy();

Search_Date_Xarcy();
Search_Between_Xarcy();
Sum_Date_Xarcy();
Count_Date_Xarcy();
}
private void Search_Between_Xarcy()
{
try
{
DataTable DaTe = new DataTable();
DaTe = CX.Search_Between_Xarcy(Date_N.Value, Date_N1.Value);
this.DG_Xarcy.DataSource = DaTe;
}
catch
{
return;
}
}

private void Search_Date_Xarcy()


{
DataTable DaTe = new DataTable();
DaTe = CX.Search_Date_Xarcy(Date_T.Value);
this.DG_Xarcy.DataSource = DaTe;
}

private void Sum_Date_Xarcy()


{
if (DG_Xarcy.Rows.Count > 0)
{
Tx_Total.Text = (from DataGridViewRow Row in DG_Xarcy.Rows
where Row.Cells[2].FormattedValue.ToString() != string.Empty
select
Convert.ToDouble(Row.Cells[2].FormattedValue)).Sum().ToString("#,###");
}
else
{
Tx_Total.Text = "0";
}
}

private void Count_Date_Xarcy()


{
Tx_Rows.Text = (from DataGridViewRow Row in DG_Xarcy.Rows
where Row.Cells[0].FormattedValue.ToString() != string.Empty
select
Convert.ToDouble(Row.Cells[0].FormattedValue)).Count().ToString();
}

public void Data_Preview()


{
try
{

DG_Xarcy.DataSource = CX.View_All_Xarcy();
}
catch
{
return;
}
}

public void View_All_Xarcy()


{
try
{
DG_Xarcy.DataSource = CX.View_All_Xarcy();
DG_Xarcy.DataSource = DaTe;
}
catch
{
return;
}
}
private void Bu_Search_One_Click_1(object sender, EventArgs e)
{
Search_Date_Xarcy();
Sum_Date_Xarcy();
Count_Date_Xarcy();
}

private void check_Show_CheckedChanged(object sender, EventArgs e)


{
if (check_Show.Checked)
{
group_Rad.Visible = true;
}
else
{
group_Rad.Visible = false;
}
}

private void Bu_Search_N_Click(object sender, EventArgs e)


{
Search_Between_Xarcy();
Search_Between_Xarcy();
Sum_Date_Xarcy();
Count_Date_Xarcy();
}

private void Print_Click(object sender, EventArgs e)


{
if (DG_Xarcy.Rows.Count > 0)
{
Frm_Re_Xarcy F_P = new Frm_Re_Xarcy();
Report_Xarcy.Cr_Re_Xarcy Cr = new Report_Xarcy.Cr_Re_Xarcy();

Cr.SetDataSource(DaTe);
F_P.crystalReportViewer1.ReportSource = Cr;
F_P.ShowDialog();

}
}

private void BuAdd_Click(object sender, EventArgs e)


{
Frm_Add_Xarcy FAX = new Frm_Add_Xarcy();
FAX.ShowDialog();
Data_Preview();
//Between_Xarcy();
Search_Between_Xarcy();
Sum_Date_Xarcy();
Count_Date_Xarcy();
}

private void Bu_Up_Click(object sender, EventArgs e)


{
try
{
Frm_Update_Xarcy FUX = new Frm_Update_Xarcy();

FUX.Tx_Xarcy_ID.Text = this.DG_Xarcy.CurrentRow.Cells[0].Value.ToString();
FUX.Combo_Xarcy.Text = DG_Xarcy.CurrentRow.Cells[1].Value.ToString();
FUX.Tx_Xarcy_Salary.Text =
Convert.ToInt32(DG_Xarcy.CurrentRow.Cells[2].Value).ToString("###,#");
FUX.Date_Xarcy.Text = DG_Xarcy.CurrentRow.Cells[3].Value.ToString();
FUX.Tx_TB.Text = DG_Xarcy.CurrentRow.Cells[4].Value.ToString();
this.DG_Xarcy.Rows.RemoveAt(this.DG_Xarcy.CurrentRow.Index);
FUX.ShowDialog();

Data_Preview();
Search_Date_Xarcy();
Search_Between_Xarcy();
Sum_Date_Xarcy();
Count_Date_Xarcy();
}
catch
{
return;
}
}

private void BuDelete_Click(object sender, EventArgs e)


{
DialogResult res;
res = MessageBox.Show("‫ "ئاگاداری‬,"‫"ئایەدەتەوێ خەرجییەکان بسڕیتەوە‬,
MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (res == DialogResult.Yes)
{
CX.Delete_Xarcy(Convert.ToInt32(this.DG_Xarcy.CurrentRow.Cells[0].Value));
Data_Preview();

Search_Date_Xarcy();
Search_Between_Xarcy();
Sum_Date_Xarcy();
Count_Date_Xarcy();
}
else
{

}
}

private void BuExit_Click(object sender, EventArgs e)


{
this.Close();
}

private void DG_Xarcy_CellDoubleClick(object sender, DataGridViewCellEventArgs e)


{
try
{
Frm_Update_Xarcy FUX = new Frm_Update_Xarcy();
FUX.Tx_Xarcy_ID.Text = this.DG_Xarcy.CurrentRow.Cells[0].Value.ToString();
FUX.Tx_Xarcy_ID.Text =
this.DG_Xarcy.Rows[e.RowIndex].Cells[0].Value.ToString();
FUX.Combo_Xarcy.Text = DG_Xarcy.Rows[e.RowIndex].Cells[1].Value.ToString();
FUX.Tx_Xarcy_Salary.Text =
Convert.ToInt32(DG_Xarcy.Rows[e.RowIndex].Cells[2].Value).ToString("#,###");
FUX.Date_Xarcy.Text = DG_Xarcy.Rows[e.RowIndex].Cells[3].Value.ToString();
FUX.Tx_TB.Text = DG_Xarcy.Rows[e.RowIndex].Cells[4].Value.ToString();
FUX.ShowDialog();
Data_Preview();

Search_Date_Xarcy();
Search_Between_Xarcy();
Sum_Date_Xarcy();
Count_Date_Xarcy();
}
catch
{
return;
}
}

private void BuClose_Click(object sender, EventArgs e)


{
this.Close();
}

private void BuMax_Click(object sender, EventArgs e)


{
this.WindowState = FormWindowState.Maximized;
BuRestore.Visible = true;
BuMax.Visible = false;
}

private void BuMin_Click(object sender, EventArgs e)


{
this.WindowState = FormWindowState.Minimized;
}

private void BuRestore_Click(object sender, EventArgs e)


{
this.WindowState = FormWindowState.Normal;
BuRestore.Visible = false;
BuMax.Visible = true;
}
}
}
‫لیستی زیادکردنی خەرجی‬

namespace Super_Market_Cc
{
public partial class Frm_Add_Xarcy : Form
{
Class_Xarcy CX = new Class_Xarcy();
public static string State = "Add";

public Frm_Add_Xarcy()
{
InitializeComponent();
BuAdd.Enabled = false;
Bu_Add.Enabled = false;
Bu_Chose.Enabled = false;
}

private void BuExit_Click(object sender, EventArgs e)


{
this.Close();
}

private void Clear()


{
Tx_Xarcy_Salary.Text = "";
Combo_Xarcy.Text = "";
Tx_TB.Text = "";

}
private void BuAdd_Click(object sender, EventArgs e)
{
try
{
if (State == "Add")
{
CX.Add_Xarcy(Convert.ToInt32(Tx_Xarcy_ID.Text), Combo_Xarcy.Text,
Convert.ToInt64(Tx_Xarcy_Salary.Text), Date_Xarcy.Value.Date, Tx_TB.Text);
MessageBox.Show("‫ "زیادکرا‬,"‫"بەسەرکەوتووی خەرجی زیادکرا‬,
MessageBoxButtons.OK, MessageBoxIcon.Information);
Clear();
Bu_Active.Enabled = true;
BuAdd.Enabled = false;
}
}
catch
{
MessageBox.Show("‫ "کێشە‬,"‫"کارەکەت هەڵەیە‬, MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}

private void Bu_Active_Click(object sender, EventArgs e)


{
try
{
Tx_Xarcy_ID.Text = CX.Xarcy_Max_ID().Rows[0][0].ToString();
Bu_Active.Enabled = false;
BuAdd.Enabled = true;
Bu_Add.Enabled = true;
Bu_Chose.Enabled = true;
}
catch
{
return;
}
}

private void Bu_Add_Click(object sender, EventArgs e)


{
if (Combo_Xarcy.Text != "")
Combo_Xarcy.Items.Add(Combo_Xarcy.Text);
Combo_Xarcy.Text = "";
Bu_Add.Enabled = false;
}

private void Bu_Chose_Click(object sender, EventArgs e)


{
Combo_Xarcy.Items.Clear();
Combo_Xarcy.Items.Add("‫;)"خەرجی ڕۆژانە‬
Combo_Xarcy.Items.Add("‫;)"پارەدان بە کرێکاران‬
Combo_Xarcy.Items.Add("‫;)"کارەبای مۆلیدە‬
Combo_Xarcy.Items.Add("‫;)"کارەبای نیشتمانی‬
Combo_Xarcy.Items.Add("‫;)"کرێی شوێن‬
Combo_Xarcy.Text = "!! ‫;"جۆری خەرجی هەڵبژێرە‬
Combo_Xarcy.SelectAll();
Bu_Chose.Enabled = false;
}

}
}
‫لیستی نوێکردنەوەی خەرجی‬

namespace Super_Market_Cc
{
public partial class Frm_Update_Xarcy : Form
{
Class_Xarcy CX = new Class_Xarcy();
public static string State = "Update";

public Frm_Update_Xarcy()
{
InitializeComponent();
Bu_Update.Enabled = false;
}

private void Clear()


{
Tx_Xarcy_Salary.Text = "";
Combo_Xarcy.Text = "";
Tx_TB.Text = "";
}

private void BuExit_Click(object sender, EventArgs e)


{
this.Close();
}

private void Bu_Update_Click(object sender, EventArgs e)


{
try
{
if (State == "Update")
{
CX.Update_Xarcy(Convert.ToInt32(Tx_Xarcy_ID.Text), Combo_Xarcy.Text,
Convert.ToDouble(Tx_Xarcy_Salary.Text), Date_Xarcy.Value.Date, Tx_TB.Text);
MessageBox.Show("‫ "نوێکرایەوە‬,"‫"بەسەرکەوتووی خەرجی نوێکرایەوە‬,
MessageBoxButtons.OK, MessageBoxIcon.Information);
Clear();
Bu_Active.Enabled = true;
Bu_Update.Enabled = false;
}
}
catch
{
return;
}
}
private void Bu_Active_Click(object sender, EventArgs e)
{
Bu_Active.Enabled = false;
Bu_Update.Enabled = true;
}
}
}

You might also like