private void txtDivision_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Return) { if (lstDivision.Items.Count > 0) { txtDivision.Text = lstDivision.Text; strProjectionKey = txtMonthID.Text + txtDivision.Text.Trim(); if (ValidateFields() == false) { return; } lstDivision.Visible = false; List <ProjectonMonthConfig> objZone = objExtra.getZoneFromDivsion(strComID, txtDivision.Text).ToList(); if (objZone.Count > 0) { lblTotalArea.Text = objZone[0].lngTotalArea.ToString(); lblTotalMpo.Text = objZone[0].lngTotalLedger.ToString(); uctxtZone.Text = objZone[0].strZone.ToString(); } LedgerAdd(txtDivision.Text); DG.Focus(); } } if (e.KeyChar == (char)Keys.Back) { DG.Focus(); } }
private void lstExpression_DoubleClick(object sender, EventArgs e) { uctxtExpression.Text = lstExpression.Text; PanelSearch.Visible = false; strPreserveSQl = ""; DG.Focus(); }
private void lstBranch_DoubleClick(object sender, EventArgs e) { uctxtbranchName.Text = lstBranch.Text; lstBranch.Visible = false; btnGenerate.PerformClick(); DG.Focus(); }
private void dtefromDate_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Return) { DG.Focus(); } }
private void lstLedgerName_DoubleClick(object sender, EventArgs e) { uctxtLedgerName.Text = lstLedgerName.Text; mAdditem(lstLedgerName.SelectedValue.ToString(), uctxtLedgerName.Text); lstLedgerName.Visible = false; DG.Focus(); }
private void CmbTests_SelectedIndexChanged(object sender, EventArgs e) { if (CmbTests.SelectedItem.ToString().Equals("All")) { GetAllTests(); DG.Focus(); return; } string processName = WorkingDirectory(CmbTests.SelectedItem.ToString()); try { DG.Rows.Clear(); Assembly asm = Assembly.LoadFrom(processName); foreach (Type type in asm.GetTypes()) { if (type.IsPublic) { string[] row = new string[] { "False", type.FullName, "", "", "", "" }; DG.Rows.Add(row); } } DG.Sort(DG.Columns[1], ListSortDirection.Ascending); DG.Rows[0].Selected = true; } catch (Exception) { MessageBox.Show("Failed To Load Tests!\nCan't Find Tests Project: " + CmbTests.SelectedItem.ToString(), "ERROR"); } DG.Focus(); }
private void uctxtItemName_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Up) { DG.Focus(); } if (e.KeyCode == Keys.Down) { DG.Focus(); } if (e.KeyCode == Keys.Return) { int i = Convert.ToInt16(DG.CurrentRow.Index); uctxtItemName.Text = DG.Rows[i].Cells[0].Value.ToString(); if (onAddAllButtonClicked != null) { onAddAllButtonClicked(GetSelectedItem(i), sender, e); } this.Dispose(); } if (e.KeyCode == Keys.C && e.Modifiers == Keys.Control) { frmStockItem objfrm = new frmStockItem(); objfrm.m_action = (int)Utility.ACTION_MODE_ENUM.ADD_MODE; objfrm.mSingleEntry = 1; objfrm.Show(); objfrm.MdiParent = this.MdiParent; } }
private void btnCommission_Click(object sender, EventArgs e) { int introw = 0; this.DGCC.DefaultCellStyle.Font = new Font("verdana", 9); DGCC.Rows.Clear(); txtCashCollection.Text = Utility.gGetReceiptAmountOfParty(strComID, uctxtMedicalRep.Text, 1, 0, dteFDate.Text, dteToDate.Text).ToString(); txtVoucherColl.Text = Utility.gGetReceiptAmountVoucher(strComID, uctxtMedicalRep.Text, 3, 1, dteFDate.Text, dteToDate.Text).ToString(); txttotalAmt.Text = (Utility.Val(txtCashCollection.Text) + Utility.Val(txtVoucherColl.Text)).ToString(); List <AccountdGroup> oogrp = accms.mDisplayMonthTarget(strComID, dteFDate.Text, dteToDate.Text, uctxtMedicalRep.Text).ToList(); if (oogrp.Count > 0) { foreach (AccountdGroup ogrp in oogrp) { DGCC.Rows.Add(); if (uctxtMonthID.Text == ogrp.strMonthID) { DGCC[0, introw].Style.BackColor = Color.Red; uctxtAmount.Text = ogrp.dblAmount.ToString(); } DGCC[0, introw].Value = ogrp.strMonthID; DGCC[1, introw].Value = ogrp.dblAmount; introw += 1; } } mLoadGroupList(); DG.Focus(); SendKeys.Send("{tab}"); SendKeys.Send("{tab}"); }
private void lstDivision_DoubleClick(object sender, EventArgs e) { lblTotalArea.Text = ""; lblTotalMpo.Text = ""; uctxtZone.Text = ""; txtDivision.Text = lstDivision.Text; strProjectionKey = txtMonthID.Text + txtDivision.Text.Trim(); if (ValidateFields() == false) { return; } if (m_action == 1) { LedgerAdd(txtDivision.Text); List <ProjectonMonthConfig> objZone = objExtra.getZoneFromDivsion(strComID, txtDivision.Text).ToList(); if (DG.RowCount > 1) { if (objZone.Count > 0) { lblTotalArea.Text = objZone[0].lngTotalArea.ToString(); lblTotalMpo.Text = objZone[0].lngTotalLedger.ToString(); uctxtZone.Text = objZone[0].strZone.ToString(); } } lstDivision.Visible = false; DG.Focus(); } }
private void lstExpression_DoubleClick(object sender, EventArgs e) { uctxtExpression.Text = lstExpression.Text; PanelSearch.Visible = false; mVoucherList(); DG.Focus(); }
private void LedgerAdd(string strDivision) { int introw = 0; DG.Rows.Clear(); ooLedgerName = objExtra.mFillMonthlyProjectionLedger(strComID, strDivision, txtMonthID.Text, 1).ToList(); if (ooLedgerName.Count > 0) { foreach (ProjectionSet ogrp in ooLedgerName) { DG.Rows.Add(); DG[0, introw].Value = ogrp.strAMFM; DG[1, introw].Value = ogrp.strMpoName; DG[2, introw].Value = ogrp.strMerzeName; DG.Columns[0].DefaultCellStyle.WrapMode = DataGridViewTriState.True; DG.Columns[2].DefaultCellStyle.WrapMode = DataGridViewTriState.True; DG.Rows[introw].Height = 43; introw += 1; } DG.AllowUserToAddRows = false; } List <ProjectionSet> ooaccVoub = objExtra.mFillDisplayMonthlyProjection(strComID, txtMonthID.Text, txtDivision.Text).ToList(); if (ooaccVoub.Count > 0) { for (int intCol = 3; intCol < DG.Columns.Count; intCol++) { string strHead1 = DG.Columns[intCol].HeaderText; foreach (ProjectionSet oCom in ooaccVoub) { string strHead = DG.Columns[oCom.intCol].HeaderText; if (strHead1 == oCom.strProjectionName) { DG[intCol, oCom.intRow].Value = oCom.dblToAmt; } } } for (int intCol = 3; intCol < DG.Columns.Count; intCol++) { string strHead1 = DG.Columns[intCol].HeaderText; string strCheck = objExtra.gCheckProjectionActive(strComID, DateTime.Now.ToString("dd-MM-yyyy")); if (strHead1 == strCheck) { DG.Columns[intCol].ReadOnly = true; DG.Columns[intCol + 1].ReadOnly = false; return; } else { DG.Columns[intCol].ReadOnly = true; } } } lstDivision.Visible = false; m_action = 2; DG.Focus(); }
private void Button_Click(object sender, RoutedEventArgs e) { var value = new DemoModel(); value.Value = $"New item {value.Id}"; Models.MainWindowModel.TestModel.ComboBoxItems.Add(value); DG.SelectedItem = value; DG.ScrollIntoView(value); DG.Focus(); }
private void txtSeacrh_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Up) { DG.Focus(); } if (e.KeyCode == Keys.Down) { DG.Focus(); } }
private void dteEffectiveDate_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Return) { DG.Focus(); } if (e.KeyChar == (char)Keys.Back) { uctxtGroupConfig.Focus(); } }
private void lstLedgerName_DoubleClick(object sender, EventArgs e) { uctxtLedgerName.Text = lstLedgerName.Text; lstLedgerName.Visible = false; if (m_action == 1) { Generate(); } DG.Focus(); SendKeys.Send("{tab}"); SendKeys.Send("{tab}"); }
private void DisplayList(List <ProjectionSet> tests, object sender, EventArgs e) { txtMonthID.Text = ""; lstDivision.Visible = false; int introw = 0; try { string strYn = ""; m_action = (int)Utility.ACTION_MODE_ENUM.EDIT_MODE; strYn = Utility.Right(tests[0].strProjectionKey, 1); uctxtOldKey.Text = tests[0].strProjectionKey; txtMonthID.Text = tests[0].strMonthID; txtDivision.Text = tests[0].strDivision; DG.Rows.Clear(); DG.Columns.Clear(); DGLoad(); List <ProjectionSet> ooaccVou = objExtra.mFillDisplayLedgerName(strComID, tests[0].strProjectionKey, txtDivision.Text).ToList(); if (ooaccVou.Count > 0) { foreach (ProjectionSet oCom in ooaccVou) { DG.Rows.Add(); DG[0, introw].Value = oCom.strAMFM; DG[1, introw].Value = oCom.strMpoName; DG[2, introw].Value = oCom.strMerzeName; introw += 1; } DG.AllowUserToAddRows = false; } List <ProjectionSet> ooaccVoub = objExtra.mFillDisplayMonthlyProjection(strComID, txtMonthID.Text, txtDivision.Text).ToList(); if (ooaccVoub.Count > 0) { foreach (ProjectionSet oCom in ooaccVoub) { DG[oCom.intCol, oCom.intRow].Value = oCom.dblToAmt; } } lstDivision.Visible = false; ZoneLoad(); DG.Focus(); } catch (Exception ex) { } }
private void uctxtSearch_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Up) { DG.Select(); DG.Focus(); } if (e.KeyCode == Keys.Down) { DG.Select(); DG.Focus(); } }
private void uctxtRefNo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Up) { DG.Focus(); } if (e.KeyCode == Keys.Down) { DG.Focus(); } if (e.KeyCode == Keys.Return) { if (DG.CurrentRow == null) { return; } int i = Convert.ToInt16(DG.CurrentRow.Index); if (lngVtype == 9999) { uctxtRefNo.Text = DG.Rows[i].Cells[0].Value.ToString(); if (onAddAllButtonClickedFG != null) { onAddAllButtonClickedFG(GetSelectedItemFG(i), sender, e); } this.Dispose(); } else if (lngVtype == 9991) { uctxtRefNo.Text = DG.Rows[i].Cells[0].Value.ToString(); if (onAddAllButtonClickedFG != null) { onAddAllButtonClickedFG(GetSelectedItemFG(i), sender, e); } this.Dispose(); } else { uctxtRefNo.Text = DG.Rows[i].Cells[1].Value.ToString(); if (uctxtRefNo.Text == "") { MessageBox.Show("Code Cannot be Found"); return; } if (onAddAllButtonClickedFG != null) { onAddAllButtonClickedFG(GetSelectedItemFG(i), sender, e); } this.Dispose(); } } }
private void ZoneLoad() { List <ProjectonMonthConfig> objZone = objExtra.getZoneFromDivsion(strComID, txtDivision.Text).ToList(); if (objZone.Count > 0) { lblTotalArea.Text = objZone[0].lngTotalArea.ToString(); lblTotalMpo.Text = objZone[0].lngTotalLedger.ToString(); uctxtZone.Text = objZone[0].strZone.ToString(); } //LedgerAdd(txtDivision.Text); lstDivision.Visible = false; DG.Focus(); }
private void uctxtExpression_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Return) { if (lstExpression.Visible) { if (lstExpression.Items.Count > 0) { uctxtExpression.Text = lstExpression.Text; } } //mFetchRecord(uctxtFindWhat.Text, uctxtExpression.Text, uctxtFromDate.Text, uctxtToDate.Text); mVoucherList(); PanelSearch.Visible = false; DG.Focus(); } }
private void uctxtbranchName_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Return) { if (lstBranch.Items.Count > 0) { uctxtbranchName.Text = lstBranch.Text; } lstBranch.Visible = false; //if (lstBranch.SelectedValue != null) //{ // mloadParty(lstBranch.SelectedValue.ToString()); //} btnGenerate.PerformClick(); DG.Focus(); } }
private void uctxtLedgerName_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Return) { if (lstLedgerName.Items.Count > 0) { uctxtLedgerName.Text = lstLedgerName.Text; } lstLedgerName.Visible = false; if (m_action == 1) { Generate(); } DG.Focus(); SendKeys.Send("{tab}"); SendKeys.Send("{tab}"); } }
private void uctxtLedgerName_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Return) { if (lstLedgerName.Items.Count > 0) { if (uctxtLedgerName.Text != "") { uctxtLedgerName.Text = lstLedgerName.Text; mAdditem(lstLedgerName.SelectedValue.ToString(), uctxtLedgerName.Text); uctxtLedgerName.Focus(); } else { DG.Focus(); } } lstLedgerName.Visible = false; } }
private void DisplayList(List <SalesTarget> tests, object sender, EventArgs e) { try { m_action = 2; txtOldKey.Text = tests[0].strKey; textBox1.Text = tests[0].strLedgerName; uctxtbranchName.Text = tests[0].strBranchName; dtefromDate.Text = tests[0].strFromDate; dteTodate.Text = tests[0].strToDate; if (tests[0].intType == 0) { radItemWise.Checked = true; } else { radPackSize.Checked = true; } btnGenerate.PerformClick(); List <SalesTarget> objtar = invms.mDisplayItemTarget(strComID, tests[0].strKey).ToList(); foreach (SalesTarget ootar in objtar) { DG[ootar.intColPos, ootar.intRowPos].Value = ootar.dblAmount; } DG.Columns[0].DefaultCellStyle.BackColor = Color.Bisque; DG.Columns[1].DefaultCellStyle.BackColor = Color.Bisque; btnGenerate.Enabled = false; radItemWise.Enabled = false; radPackSize.Enabled = false; dtefromDate.Enabled = false; dteTodate.Enabled = false; DG.Focus(); SendKeys.Send("{tab}"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void lstBranch_DoubleClick(object sender, EventArgs e) { uctxtbranchName.Text = lstBranch.Text; if (btnGenerate.Enabled) { var strResponseInsert = MessageBox.Show("Do You Want to Generate?", "Generate Button", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (strResponseInsert == DialogResult.Yes) { btnGenerate.Focus(); } else { btnSave.Focus(); } } else { DG.Focus(); } lstBranch.Visible = false; }
private void InCome_Load(object sender, EventArgs e) { string sql = "select DocEntry,cast(DocEntry as varchar)+'--'+U_CardCode as cardname from " + ConnModel.commonDB + "..[@SBO_ZJD] where U_DJZT = 'W' order by docnum desc"; DataTable dt = SqlHelper.GetDataTable(sql, CommandType.Text); cmbStockNo.DataSource = dt; cmbStockNo.ValueMember = "DocEntry"; cmbStockNo.DisplayMember = "cardname"; DG.Focus(); if (cmbStockNo.Text != "") { //取出入库员 OHEM 员工表 2017.06.09 新需求中不需要在PDA显示入库员 //string sql2 = "SELECT empID , ISNULL(T1.firstName,'')+ISNULL(T1.middleName,'')+ISNULL(T1.lastName,'') as name FROM " + ConnModel.commonDB + "..OHEM T1"; //DataTable tbl2 = SqlHelper.GetDataTable(sql2, CommandType.Text); //cmbRky.DataSource = tbl2; //cmbRky.ValueMember = "empID"; //cmbRky.DisplayMember = "name"; } else { MessageBox.Show("请先生成质检单!"); this.Close(); } }
private void btnSave_Click(object sender, EventArgs e) { string strmsg = "", strkey = "", strbranchID = "", strDG = "", strDuplicate = ""; int intStatus = 0; if (uctxtBranch.Text == "") { MessageBox.Show("Cannot be Empty"); uctxtBranch.Focus(); return; } if (uctxtGroupConfig.Text == "") { MessageBox.Show("Cannot be Empty"); uctxtGroupConfig.Focus(); return; } if (radNormal.Checked == true) { intStatus = 0; } else { intStatus = 1; } if (Utility.gblnAccessControl) { if (!Utility.glngGetPriviliges(strComID, Utility.gstrUserName, lngFormPriv, m_action)) { MessageBox.Show("You have no Permission to Access", "Privileges", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } double dblFormAmnt = 0, dblExFormAmnt = 0, dblToAmnt = 0; for (int i = 0; i < DG.Rows.Count - 1; i++) { if (i > 0) { dblFormAmnt = dblFormAmnt + 1; dblToAmnt = Convert.ToDouble(Utility.Val(DG[1, i].Value.ToString())); } if (i > 0) { if (dblFormAmnt != dblExFormAmnt) { MessageBox.Show("Amount Mismatch ! Please Check Your From Amount " + dblExFormAmnt); DG.Focus(); return; } if (dblToAmnt < dblFormAmnt) { MessageBox.Show("Amount Mismatch ! Please Check Your To Amount " + dblToAmnt); DG.Focus(); return; } } dblFormAmnt = Convert.ToDouble(Utility.Val(DG[1, i].Value.ToString())); if (DG[0, i + 1].Value != null) { dblExFormAmnt = Convert.ToDouble(Utility.Val(DG[0, i + 1].Value.ToString())); } } strbranchID = Utility.gstrGetBranchID(strComID, uctxtBranch.Text); strkey = strbranchID + uctxtGroupConfig.Text + dteEffectiveDate.Value.ToString("ddMMyyyy") + intStatus; for (int i = 0; i < DG.Rows.Count - 1; i++) { strDG = strDG + Utility.gCheckNull(DG[0, i].Value.ToString()) + "," + Utility.gCheckNull(DG[1, i].Value.ToString()) + "," + Utility.gCheckNull(DG[2, i].Value.ToString()) + "~"; } if (m_action == 1) { strDuplicate = Utility.mCheckDuplicateItem(strComID, "INV_GROUP_COMMISSION_MASTER", "GROUP_COMMISSION_KEY", strkey); if (strDuplicate != "") { MessageBox.Show("Cannot Insert Duplicate Effective Date"); uctxtGroupConfig.Focus(); return; } var strResponseInsert = MessageBox.Show("Do You want to Save?", "Save Button", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (strResponseInsert == DialogResult.Yes) { try { strmsg = invms.mInsertCommission(strComID, strkey, strbranchID, uctxtGroupConfig.Text, dteEffectiveDate.Text, intStatus, strDG); if (strmsg == "Inseretd...") { if (Utility.gblnAccessControl) { string strAudit = Utility.gblnAuditTrail(Utility.gstrUserName, DateTime.Now.ToString("dd/MM/yyyy"), strFormName, uctxtGroupConfig.Text, 1, 0, (int)Utility.MODULE_TYPE.mtSTOCK, "0001"); } uctxtBranch.Text = ""; uctxtGroupConfig.Text = ""; DG.Rows.Clear(); uctxtBranch.Focus(); } } catch (Exception EX) { MessageBox.Show(strmsg); } } } else { if (strOldGroup != uctxtGroupConfig.Text) { { strDuplicate = Utility.mCheckDuplicateItem(strComID, "INV_GROUP_COMMISSION_MASTER", "GROUP_COMMISSION_KEY", strkey); if (strDuplicate != "") { MessageBox.Show(strDuplicate); uctxtGroupConfig.Text = ""; uctxtGroupConfig.Focus(); return; } } } var strResponseInsert = MessageBox.Show("Do You want to Update?", "Save Button", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (strResponseInsert == DialogResult.Yes) { try { strmsg = invms.mUpdateCommisssion(strComID, txtOldKey.Text, strkey, strbranchID, uctxtGroupConfig.Text, dteEffectiveDate.Text, intStatus, strDG); if (strmsg == "Updated...") { if (Utility.gblnAccessControl) { string strAudit = Utility.gblnAuditTrail(Utility.gstrUserName, DateTime.Now.ToString("dd/MM/yyyy"), strFormName, uctxtGroupConfig.Text, 2, 0, (int)Utility.MODULE_TYPE.mtSTOCK, "0001"); } uctxtBranch.Text = ""; uctxtGroupConfig.Text = ""; uctxtGroupConfig.Enabled = true; uctxtBranch.Enabled = true; DG.Rows.Clear(); uctxtBranch.Focus(); m_action = 1; } } catch (Exception EX) { MessageBox.Show(strmsg); } } } }
private void DisplayList(List <ProjectionSet> tests, object sender, EventArgs e) { txtMonthID.Text = ""; lstDivision.Visible = false; int introw = 0; try { string strYn = ""; m_action = (int)Utility.ACTION_MODE_ENUM.EDIT_MODE; strYn = Utility.Right(tests[0].strProjectionKey, 1); uctxtOldKey.Text = tests[0].strProjectionKey; txtMonthID.Text = tests[0].strMonthID; txtDivision.Text = tests[0].strDivision; DG.Rows.Clear(); DG.Columns.Clear(); DGLoad(); string strName1 = ""; List <ProjectionSet> ooaccVou = objExtra.mFillDisplayLedgerName(strComID, tests[0].strProjectionKey, txtDivision.Text).ToList(); if (ooaccVou.Count > 0) { foreach (ProjectionSet oCom in ooaccVou) { DG.Rows.Add(); if (strName1 != oCom.strAMFM) { DG[0, introw].Value = "Area Total:"; DG.Rows[introw].DefaultCellStyle.BackColor = Color.Aqua; DG.Rows[introw].DefaultCellStyle.ForeColor = Color.Red; introw += 1; DG.Rows.Add(); DG[0, introw].Value = oCom.strAMFM; DG[1, introw].Value = oCom.strMpoName; DG[2, introw].Value = oCom.strMerzeName; List <ProjectionSet> ooaccVoub = objExtra.mFillDisplayMonthlyProjection(strComID, txtMonthID.Text, oCom.strMpoName, tests[0].strProjectionKey).ToList(); if (ooaccVoub.Count > 0) { foreach (ProjectionSet oComfff in ooaccVoub) { DG[oComfff.intCol, introw].Value = oComfff.dblToAmt; } DG.Columns[0].DefaultCellStyle.WrapMode = DataGridViewTriState.True; DG.Columns[2].DefaultCellStyle.WrapMode = DataGridViewTriState.True; } } else { DG[0, introw].Value = oCom.strAMFM; DG[1, introw].Value = oCom.strMpoName; DG[2, introw].Value = oCom.strMerzeName; List <ProjectionSet> ooaccVoub = objExtra.mFillDisplayMonthlyProjection(strComID, txtMonthID.Text, oCom.strMpoName, tests[0].strProjectionKey).ToList(); if (ooaccVoub.Count > 0) { foreach (ProjectionSet oComfff in ooaccVoub) { DG[oComfff.intCol, introw].Value = oComfff.dblToAmt; } DG.Columns[0].DefaultCellStyle.WrapMode = DataGridViewTriState.True; DG.Columns[2].DefaultCellStyle.WrapMode = DataGridViewTriState.True; } } strName1 = oCom.strAMFM; DG.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; DG.Columns[0].DefaultCellStyle.WrapMode = DataGridViewTriState.True; DG.Columns[2].DefaultCellStyle.WrapMode = DataGridViewTriState.True; DG.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; DG.Rows[introw].Height = 50; introw += 1; } DG.AllowUserToAddRows = false; } if (introw == Convert.ToInt32(DG.Rows.Count)) { DG.Rows.Add(); DG[0, introw].Value = "Division Total:"; DG.Rows[introw].DefaultCellStyle.BackColor = Color.HotPink; } //List<ProjectionSet> ooaccVoub1 = objExtra.mFillDisplayMonthlyProjection(strComID, txtMonthID.Text, txtDivision.Text, tests[0].strProjectionKey).ToList(); //if (ooaccVoub1.Count > 0) //{ // foreach (ProjectionSet oCom in ooaccVoub1) // { // //DG[oCom.intCol, oCom.intRow].Value = oCom.dblToAmt; // mCalculateGridTotal(oCom.intCol); // mCalculateRowTotal(oCom.intRow); // } // DG.Columns[0].DefaultCellStyle.WrapMode = DataGridViewTriState.True; // DG.Columns[2].DefaultCellStyle.WrapMode = DataGridViewTriState.True; //} mCalculateRowTotalNew(); lstDivision.Visible = false; ZoneLoad(); DG.Focus(); } catch (Exception ex) { } }
private bool ValidateFields() { double dblClosingQTY = 0, dblCurrentQTY = 0; string strBillKey = "", strNegetiveItem = ""; int intCheckNegetive = 0; //if (Utility.gblnAccessControl) //{ // if (!Utility.glngGetPriviliges(strComID,Utility.gstrUserName, lngFormPriv, m_action)) // { // MessageBox.Show("You have no Permission to Access","Privileges",MessageBoxButtons.OK,MessageBoxIcon.Warning ); // return false; // } //} if (uctxtInvoiceNo.Text == "") { MessageBox.Show("Name Cannot be Empty"); uctxtInvoiceNo.Focus(); return(false); } if (uctxtBranchName.Text == "") { MessageBox.Show("Name Cannot be Empty"); uctxtBranchName.Focus(); return(false); } if (uctxtFromLocation.Text == "") { MessageBox.Show("Name Cannot be Empty"); uctxtFromLocation.Focus(); return(false); } long lngDate = Convert.ToInt64(dteDate.Value.ToString("yyyyMMdd")); long lngFiscalYearfrom = Convert.ToInt64(Convert.ToDateTime(Utility.gdteFinancialYearFrom).ToString("yyyyMMdd")); long lngFiscalYearTo = Convert.ToInt64(Convert.ToDateTime(Utility.gdteFinancialYearTo).ToString("yyyyMMdd")); if (lngDate < lngFiscalYearfrom) { MessageBox.Show("Invalid Date, Date Can't less then Financial Year"); return(false); } if (lngDate > lngFiscalYearTo) { MessageBox.Show("Invalid Date, Date Can't less then Financial Year"); return(false); } string strBacklockDate = Utility.gCheckBackLock(strComID); if (strBacklockDate != "") { long lngBackdate = Convert.ToInt64(Convert.ToDateTime(strBacklockDate).ToString("yyyyMMdd")); if (lngDate <= lngBackdate) { MessageBox.Show("Invalid Date, Back Date is locked"); return(false); } } if (DG.Rows.Count == 0) { MessageBox.Show("Item Cannot be Empty"); uctxtItemName.Focus(); return(false); } if (Utility.Val(lblnetAmount.Text) == 0 || Utility.Val(lblnetAmount.Text) < 0) { MessageBox.Show("Net Amount be Empty"); uctxtItemName.Focus(); return(false); } if (m_action == 1) { string strDuplicate = Utility.mCheckDuplicateItem(strComID, "INV_MASTER", "INV_REF_NO", uctxtInvoiceNo.Text); if (strDuplicate != "") { MessageBox.Show(strDuplicate); uctxtInvoiceNo.Text = ""; uctxtInvoiceNo.Focus(); return(false); } } string strBranchID = lstBranchName.SelectedValue.ToString(); if (intvType != (int)Utility.VOUCHER_TYPE.vtSTOCK_MFG_FINISHED_GOODS) { if (oinv[0].mlngBlockNegativeStock > 0) { for (int i = 0; i < DG.Rows.Count; i++) { if (DG[0, i].Value.ToString() != "") { if (DG[6, i].Value != null) { strBillKey = DG[6, i].Value.ToString(); } dblClosingQTY = Utility.gdblClosingStock(strComID, DG[0, i].Value.ToString(), uctxtFromLocation.Text, dteDate.Text); if (m_action == (int)Utility.ACTION_MODE_ENUM.EDIT_MODE) { dblClosingQTY = dblClosingQTY + Utility.gdblGetBillQtyStationary(strComID, strBillKey); } dblCurrentQTY = Utility.Val(DG[1, i].Value.ToString()); if ((dblClosingQTY) - dblCurrentQTY < 0) { strNegetiveItem = strNegetiveItem + Environment.NewLine + DG[0, i].Value.ToString(); intCheckNegetive = 1; dblClosingQTY = 0; } else if (dblClosingQTY == 0) { strNegetiveItem = strNegetiveItem + Environment.NewLine + DG[0, i].Value.ToString(); intCheckNegetive = 1; dblClosingQTY = 0; } } dblClosingQTY = 0; } if (intCheckNegetive > 0) { MessageBox.Show("You have no valid quantity for Item: " + strNegetiveItem); dblClosingQTY = 0; DG.Focus(); return(false); } } } return(true); }
private bool ValidateFields() { double dblClosingQTY = 0, dblCurrentQTY = 0; string strBillKey = "", strNegetiveItem = ""; int intCheckNegetive = 0; //if (Utility.gblnAccessControl) //{ // if (!Utility.glngGetPriviliges(strComID, Utility.gstrUserName, lngFormPriv, m_action)) // { // MessageBox.Show("You have no Permission to Access","Privileges",MessageBoxButtons.OK,MessageBoxIcon.Warning ); // return false; // } //} if (uctxtInvoiceNo.Text == "") { MessageBox.Show("Cannot be Empty"); uctxtInvoiceNo.Focus(); return(false); } if (uctxtFromLocation.Text == "") { MessageBox.Show("Cannot be Empty"); uctxtFromLocation.Focus(); return(false); } if (DG.Rows.Count == 0) { MessageBox.Show("Item Cannot be Empty"); uctxtItemName.Focus(); return(false); } if (uctxtFromLocation.Text.TrimStart() == uctxtToLocation.Text.TrimStart()) { MessageBox.Show("Both Location Cannot be Same"); uctxtFromLocation.Focus(); return(false); } //if (Utility.Val(lblAmount.Text) == 0 || Utility.Val(lblAmount.Text) < 0) //{ // MessageBox.Show("Net Amount Cannot be Empty"); // uctxtItemName.Focus(); // return false; //} string strLockvoucher = Utility.gLockVocher(strComID, mintVtype); long lngDate = Convert.ToInt64(Convert.ToDateTime(dteDate.Text).ToString("yyyyMMdd")); if (strLockvoucher != "") { long lngBackdate = Convert.ToInt64(Convert.ToDateTime(strLockvoucher).ToString("yyyyMMdd")); if (lngDate <= lngBackdate) { MessageBox.Show("Invalid Date, Back Date is locked"); return(false); } } if (m_action == 1) { string strDuplicate = Utility.mCheckDuplicateItem(strComID, "INV_TRAN", "INV_REF_NO", uctxtInvoiceNo.Text); if (strDuplicate != "") { MessageBox.Show(strDuplicate); uctxtInvoiceNo.Text = ""; uctxtInvoiceNo.Focus(); return(false); } } string strBranchID = Utility.gstrGetBranchIDfromGodown(strComID, uctxtFromLocation.Text.Trim()); if (oinv[0].mlngBlockNegativeStock > 0) { for (int i = 0; i < DG.Rows.Count; i++) { if (DG[0, i].Value.ToString() != "") { if (DG[8, i].Value != null) { strBillKey = DG[8, i].Value.ToString(); } else { strBillKey = ""; } dblClosingQTY = Utility.gdblClosingStock(strComID, DG[0, i].Value.ToString(), uctxtFromLocation.Text, dteDate.Text); //dblClosingQTY = Utility.gdblClosingStockSales(strComID, DG[0, i].Value.ToString(), strBranchID, "",uctxtFromLocation.Text); if (m_action == (int)Utility.ACTION_MODE_ENUM.EDIT_MODE) { dblClosingQTY = dblClosingQTY + Utility.gdblGetBillQty(strComID, strBillKey, uctxtFromLocation.Text); } dblCurrentQTY = Utility.Val(DG[2, i].Value.ToString()); if ((dblClosingQTY) - dblCurrentQTY < 0) { strNegetiveItem = strNegetiveItem + Environment.NewLine + DG[0, i].Value.ToString(); intCheckNegetive = 1; dblClosingQTY = 0; } else if (dblClosingQTY == 0) { strNegetiveItem = strNegetiveItem + Environment.NewLine + DG[0, i].Value.ToString(); intCheckNegetive = 1; dblClosingQTY = 0; } } dblClosingQTY = 0; } if (intCheckNegetive > 0) { MessageBox.Show("You have no valid quantity for Item: " + strNegetiveItem); dblClosingQTY = 0; DG.Focus(); return(false); } } return(true); }