private void frmCustomerSupport_Load(object sender, EventArgs e) { string strItem; string strCustomerName; string strCustomerCode; this.cmbCustomers.Items.Add("همه مشتریان"); DataTable dtCustomerNames = new DataTable(); BL_frmCustomerSupport M = new BL_frmCustomerSupport(); dtCustomerNames = M.CustomerList(); int i; for (i = 0; i <= dtCustomerNames.Rows.Count - 1; i++) { strCustomerName = Convert.ToString(dtCustomerNames.Rows[i][1]); strCustomerCode = Convert.ToString(dtCustomerNames.Rows[i][0]); strItem = strCustomerName + "(" + strCustomerCode + ")"; this.cmbCustomers.Items.Add(strItem); } this.cmbCustomers.SelectedIndex = 0; }
private void btnSalesHistory_Click(object sender, EventArgs e) { string strCustomerCode; DataTable dtCustomerNames = new DataTable(); BL_frmCustomerSupport M = new BL_frmCustomerSupport(); dtCustomerNames = M.CustomerList(); int intindex; if (this.txtSelectedCode.Text == "") { MessageBox.Show("هیچ محصولی انتخاب نشده است", "خطا", MessageBoxButtons.OK); return; } if (this.cmbCustomers.SelectedIndex == 0) { M.Code = this.txtSelectedCode.Text.ToString(); this.grdSalesHistory.DataSource = M.SalesHistoryAll(); } else { intindex = cmbCustomers.SelectedIndex - 1; strCustomerCode = Convert.ToString(dtCustomerNames.Rows[intindex][0]); //MessageBox.Show(strCustomerCode, "customer code", MessageBoxButtons.OK); M.Code = this.txtSelectedCode.Text.ToString(); M.CustomerCode = strCustomerCode; this.grdSalesHistory.DataSource = M.SalesHistoryByCustomerCode(); } this.grdSalesHistory.Columns[0].Visible = false; this.grdSalesHistory.Columns[1].Visible = false; //this.grdSalesHistory.Columns[2].Visible = false; this.grdSalesHistory.Columns[3].Visible = false; //this.grdSalesHistory.Columns[4].Visible = false; this.grdSalesHistory.Columns[5].Visible = false; this.grdSalesHistory.Columns[6].Visible = false; this.grdSalesHistory.Columns[7].Visible = false; this.grdSalesHistory.Columns[8].Visible = false; this.grdSalesHistory.Columns[9].Visible = false; this.grdSalesHistory.Columns[10].Visible = false; //this.grdSalesHistory.Columns[11].Visible = false; //this.grdSalesHistory.Columns[12].Visible = false; this.grdSalesHistory.Columns[13].Visible = false; this.grdSalesHistory.Columns[14].Visible = false; this.grdSalesHistory.Columns[2].HeaderText = "تاریخ"; this.grdSalesHistory.Columns[4].HeaderText = "نام مشتری"; this.grdSalesHistory.Columns[11].HeaderText = "تعداد"; this.grdSalesHistory.Columns[12].HeaderText = "قیمت واحد"; M.OriginCode = txtSelectedCode.Text.ToString(); M.DestinationCode = txtSelectedCode.Text.ToString(); this.grdSearchDestination.DataSource = M.SearchOrigin(); this.grdSearchDestination.Columns[0].Visible = false; this.grdSearchDestination.Columns[1].Visible = false; this.grdSearchDestination.Columns[2].Visible = false; this.grdSearchDestination.Columns[3].Visible = false; this.grdSearchDestination.Columns[4].Visible = false; //this.grdSearchDestination.Columns[5].Visible = false; //this.grdSearchDestination.Columns[6].Visible = false; //this.grdSearchDestination.Columns[7].Visible = false; //this.grdSearchDestination.Columns[8].Visible = false; this.grdSearchDestination.Columns[9].Visible = false; this.grdSearchDestination.Columns[10].Visible = false; this.grdSearchDestination.Columns[5].HeaderText = "کد محصول"; this.grdSearchDestination.Columns[5].Width = 70; this.grdSearchDestination.Columns[6].HeaderText = "شماره فنی"; this.grdSearchDestination.Columns[6].Width = 100; this.grdSearchDestination.Columns[7].HeaderText = "شرح محصول"; this.grdSearchDestination.Columns[7].Width = 240; this.grdSearchDestination.Columns[8].HeaderText = "کد ریورک"; this.grdSearchDestination.Columns[8].Width = 80; this.grdSearchOrigin.DataSource = M.SearchDestination(); this.grdSearchOrigin.Columns[0].Visible = false; this.grdSearchOrigin.Columns[1].Visible = false; //this.grdSearchOrigin.Columns[2].Visible = false; //this.grdSearchOrigin.Columns[3].Visible = false; //this.grdSearchOrigin.Columns[4].Visible = false; this.grdSearchOrigin.Columns[5].Visible = false; this.grdSearchOrigin.Columns[6].Visible = false; this.grdSearchOrigin.Columns[7].Visible = false; //this.grdSearchOrigin.Columns[8].Visible = false; this.grdSearchOrigin.Columns[9].Visible = false; this.grdSearchOrigin.Columns[10].Visible = false; this.grdSearchOrigin.Columns[2].HeaderText = "کد محصول"; this.grdSearchOrigin.Columns[2].Width = 70; this.grdSearchOrigin.Columns[3].HeaderText = "شماره فنی"; this.grdSearchOrigin.Columns[3].Width = 100; this.grdSearchOrigin.Columns[4].HeaderText = "شرح محصول"; this.grdSearchOrigin.Columns[4].Width = 240; this.grdSearchOrigin.Columns[8].HeaderText = "کد ریورک"; this.grdSearchOrigin.Columns[8].Width = 80; }
private void btnShow_Click(object sender, EventArgs e) { if (txtFDate1.Text == "" || txtFDate2.Text == "") { MessageBox.Show("لطفا محدوده تاریخ را وارد کنید", "خطا", MessageBoxButtons.OK); return; } bool validfdate1 = G.ValidateParsianDate(txtFDate1.Text.ToString()); bool validfdate2 = G.ValidateParsianDate(txtFDate2.Text.ToString()); if (validfdate1 == false || validfdate2 == false) { txtFDate1.BackColor = Color.Red; txtFDate1.ForeColor = Color.White; txtFDate2.BackColor = Color.Red; txtFDate2.ForeColor = Color.White; MessageBox.Show("تاریخ را بطور صحیح وارد کنید", "خطا", MessageBoxButtons.OK); return; } else { txtFDate1.BackColor = Color.White; txtFDate1.ForeColor = Color.Black; txtFDate2.BackColor = Color.White; txtFDate2.ForeColor = Color.Black; } string strCustomerCode = ""; DataTable dtCustomerNames = new DataTable(); BL_frmCustomerSupport M = new BL_frmCustomerSupport(); dtCustomerNames = M.CustomerList(); int intindex; if (this.cmbCustomers.SelectedIndex != 0) { intindex = cmbCustomers.SelectedIndex - 1; strCustomerCode = Convert.ToString(dtCustomerNames.Rows[intindex][0]); MessageBox.Show(strCustomerCode, "customer code", MessageBoxButtons.OK); } //گزارش کلی از کلیه مشتریان if (cmbReportType.SelectedIndex == 0 && cmbCustomers.SelectedIndex == 0) { BL_frmReporting M1 = new BL_frmReporting(); M1.FDate1 = this.txtFDate1.Text.ToString(); M1.FDate2 = this.txtFDate2.Text.ToString(); this.dataGridView1.DataSource = M1.TotalizedAll(); TotalizedDatagridUpdate(); this.txtTotalPrice.Text = Convert.ToString(M1.GetSumTotalizedAll()); this.txtTotalTax.Text = Convert.ToString(M1.GetTaxTotalizedAll()); } // گزارش کلی از یک مشتری مشحض if (cmbReportType.SelectedIndex == 0 && cmbCustomers.SelectedIndex != 0) { BL_frmReporting M2 = new BL_frmReporting(); M2.FDate1 = this.txtFDate1.Text.ToString(); M2.FDate2 = this.txtFDate2.Text.ToString(); M2.CustomerCode = strCustomerCode; this.dataGridView1.DataSource = M2.TotalizedByCustomer(); TotalizedDatagridUpdate(); this.txtTotalPrice.Text = Convert.ToString(M2.GetSumTotalizedByCustomer()); this.txtTotalTax.Text = Convert.ToString(M2.GetTaxTotalizedByCustomer()); } // گزارش جزئی از کلیه مشتریان if (cmbReportType.SelectedIndex == 1 && cmbCustomers.SelectedIndex == 0) { BL_frmReporting M3 = new BL_frmReporting(); M3.FDate1 = this.txtFDate1.Text.ToString(); M3.FDate2 = this.txtFDate2.Text.ToString(); this.dataGridView1.DataSource = M3.DetailedAll(); DetailedDatagridUpdate(); this.txtTotalPrice.Text = Convert.ToString(M3.GetSumDetailedAll()); //this.txtTotalPrice.Text="Error"; this.txtTotalTax.Text = Convert.ToString(M3.GetTaxDetailedAll()); //this.txtTotalTax.Text = "Error"; } // گزراش جزئی از یک مشتری مشخص if (cmbReportType.SelectedIndex == 1 && cmbCustomers.SelectedIndex != 0) { BL_frmReporting M4 = new BL_frmReporting(); M4.FDate1 = this.txtFDate1.Text.ToString(); M4.FDate2 = this.txtFDate2.Text.ToString(); M4.CustomerCode = strCustomerCode; this.dataGridView1.DataSource = M4.DetailedByCustomer(); DetailedDatagridUpdate(); this.txtTotalPrice.Text = Convert.ToString(M4.GetSumDetailedByCustomer()); //this.txtTotalPrice.Text = "Error"; this.txtTotalTax.Text = Convert.ToString(M4.GetTaxDetailedByCustomer()); //this.txtTotalTax.Text = "Error"; } }