public bool SupplierValid(string Supplier, Rule SupplierRule, DateTime Date, int PO_ID) { bool valid = true; string sSQL = @"exec AP_SuppSubCon_Valid null, '" + Supplier + @"', '" + Date.ToShortDateString() + @"', " + GetRuleNo(SupplierRule) + @", " + PO_ID; DataTable dt = Connection.SQLExecutor.ExecuteDataAdapter(sSQL, Connection.TRConnection); if (dt != null) { if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; if (dr != null) { if (Convert.ToInt32(dr[0]) > 0) { valid = false; Popup.ShowPopup(dr[1].ToString()); } } } } return(valid); }
private void btnUpdate_Click(object sender, System.EventArgs e) { if (luePO.EditValue == null) { Popup.ShowPopup("No PO has been selected."); return; } if (lueSupplier.EditValue == null) { Popup.ShowPopup("No replacement Supplier has been selected."); return; } if (Popup.ShowPopup("Are you sure you want to change the supplier on this PO?", frmPopup.PopupType.OK_Cancel) == frmPopup.PopupResult.OK) { string sUpdate = "declare @supplier_id int " + "select @supplier_id=supplier_id from SUPPLIER_MASTER where SUPPLIER='" + lueSupplier.EditValue + "' " + "update po_header set supplier='" + lueSupplier.EditValue + "', supp_name='" + lueSupplier.GetColumnValue("NAME").ToString().Replace("'", "''") + "' where po_id=" + luePO.EditValue + " " + "update so_tasks set vendor=@supplier_id, vendor_description='" + lueSupplier.GetColumnValue("NAME").ToString().Replace("'", "''") + "' where id in (select so_task_id from po_detail where so_task_id is not null and po_id=" + luePO.EditValue + ")"; Connection.SQLExecutor.ExecuteNonQuery(sUpdate, Connection.TRConnection); this.DialogResult = DialogResult.OK; this.Close(); } }
private void btnSave_Click(object sender, System.EventArgs e) { bool Closable = true; string sSelect = "select isnull(other_gst_exceptions,'F') from ap_setup"; object obj = ExecuteScalar(sSelect, TR_Conn); if (obj != null && obj != DBNull.Value) { if (obj.ToString().ToUpper() == "T" && ucAPGSTE.radException.SelectedIndex == 4) { if (ucAPGSTE.lueOther.EditValue == null || ucAPGSTE.lueOther.EditValue == DBNull.Value) { Popup.ShowPopup(this, "Other GST Exception required before saving."); Closable = false; } } } if (Closable) { ucAPGSTE.Readonly = true; this.DialogResult = DialogResult.OK; this.Close(); } }
private void gvSuppCon_InvalidRowException(object sender, DevExpress.XtraGrid.Views.Base.InvalidRowExceptionEventArgs e) { Popup.ShowPopup(e.ErrorText); e.ExceptionMode = DevExpress.XtraEditors.Controls.ExceptionMode.NoAction; }
private void btnPrint_Click(object sender, System.EventArgs e) { string sSelect = "select count(*) from ap_inv_header where isnull(PAYMENT_HOLD,'F') = 'T' and ap_inv_header_id=" + _AP_INV_HEADER_ID; if (Convert.ToInt32(ExecuteScalar(sSelect, TR_Conn)) > 0) { string sMessage = "Unable to process payment, payment hold currently exists on invoice."; Popup.ShowPopup(sMessage); this.DialogResult = DialogResult.Cancel; this.Close(); return; } object oBank = lueBank.EditValue; if (oBank != null) { if (txtCheckNo.Text.Trim() != "") { if ((ucAccountingPicker1.SelectedYear < _Year) || (ucAccountingPicker1.SelectedYear == _Year && ucAccountingPicker1.SelectedPeriod < _Period)) { Popup.ShowPopup("Selected year and period must be equal to or greater than the invoice accrual year and period."); return; } string ReportName = ExecuteScalar("select isnull(cheque_report,'') from ap_setup", TR_Conn).ToString(); if (ReportName == "") { Popup.ShowPopup("No check report has been specified."); return; } string sFirstChkNo = txtCheckNo.EditValue.ToString(); string sChkDate = deChkDate.DateTime.ToShortDateString(); string sExec = "exec sp_APFillQuickChk '" + Connection.MLUser + "', " + _AP_INV_HEADER_ID + ", '" + chkIncludeHB.EditValue + "'"; string sMessage = ExecuteScalar(sExec, TR_Conn).ToString(); if (sMessage == "OK") { sExec = @"declare @message varchar(max) exec sp_APQuickCheckPrint '" + Connection.MLUser + @"', '" + sChkDate + @"', " + oBank + @", " + sFirstChkNo + @", null, @message output select @message"; object oMessage = Connection.SQLExecutor.ExecuteScalar(sExec, Connection.TRConnection); if (oMessage == null || oMessage == DBNull.Value) { Popup.ShowPopup("Error generating check data."); return; } if (!oMessage.Equals("OK")) { Popup.ShowPopup(oMessage.ToString()); return; } string sUpdateMessage = "Update and post manual check to the period: " + ucAccountingPicker1.SelectedYear + " / " + ucAccountingPicker1.SelectedPeriod + ", " + PeriodName(ucAccountingPicker1.SelectedPeriod) + "?"; if (!b_Manual) { CheckElectronicSaving(); string[,] saParams = new string[2, 1]; saParams[0, 0] = "@USERNAME"; saParams[1, 0] = Connection.MLUser; frmHM_Report_Printer HMRP = new frmHM_Report_Printer(Connection, myMgr, saParams, ReportName, frmHM_Report_Printer.DBFlavor.TR); sSelect = "select isnull(ALLOW_CHK_PREVIEW,'F') from ap_setup"; if (ExecuteScalar(sSelect, TR_Conn).ToString().ToUpper() == "T") { HMRP.ShowPreview = true; } else { HMRP.ShowPreview = false; } HMRP.ElectronicSaving(false, b_ElectronicSaving); HMRP.ElectronicSave += new frmHM_Report_Printer.ElectronicSaveDelegate(HMRP_ElectronicSave); ElectronicSave = false; HMRP.ShowDialog(); IDisposable dispose = HMRP; dispose.Dispose(); sUpdateMessage = "Printed OK? Continue with update, and post to the period: " + ucAccountingPicker1.SelectedYear + " / " + ucAccountingPicker1.SelectedPeriod + ", " + PeriodName(ucAccountingPicker1.SelectedPeriod) + "?"; } if (Popup.ShowPopup(this, sUpdateMessage, frmPopup.PopupType.OK_Cancel) == frmPopup.PopupResult.OK) { sMessage = ProcessCheck(); if (sMessage == "OK") { if (!b_Manual) { UpdateChkNo(); if (ElectronicSave) { Check_ElectronicSave(); } } this.DialogResult = DialogResult.OK; this.Close(); } else { Popup.ShowPopup(sMessage); } } } else { if (chkIncludeHB.Enabled) { Popup.ShowPopup(sMessage); } else { Popup.ShowPopup("A holdback balance only remains on this invoice, but the holdback has not been approved yet."); } } } else { Popup.ShowPopup(this, "Please enter a starting check number."); } } else { Popup.ShowPopup(this, "Please select a bank."); } }
public bool ValidateRequest() { bool bValid = true; string sMessage = ""; btnSave_Click(null, null); if (txtInvNo.Text.Trim().Equals("")) { bValid = false; xtraTabControl1.SelectedTabPageIndex = 0; txtInvNo.Focus(); sMessage = "Invoice number is required."; goto Error; } string sSelect = @"declare @inv_no varchar(15), @supplier varchar(10) select @inv_no=con_inv_no, @supplier=supplier from ws_inv_header where ws_inv_id=" + _DetailID + @" select count(*) from ap_inv_header where inv_no=@inv_no and supplier=@supplier"; if (Convert.ToInt32(Connection.SQLExecutor.ExecuteScalar(sSelect, Connection.TRConnection)) > 0) { bValid = false; xtraTabControl1.SelectedTabPageIndex = 0; txtInvNo.Focus(); sMessage = "The selected invoice number already exists, a different number is required before this request can be approved."; goto Error; } if (lueWHSE.EditValue == null || lueWHSE.EditValue == DBNull.Value) { bValid = false; xtraTabControl1.SelectedTabPageIndex = 0; lueWHSE.Focus(); sMessage = "A warehouse is required before this request can be approved."; goto Error; } if (lueGST.EditValue == null || lueGST.EditValue == DBNull.Value) { bValid = false; xtraTabControl1.SelectedTabPageIndex = 0; lueGST.Focus(); sMessage = "A " + lueGST.Text + " code is required before this request can be approved."; goto Error; } sSelect = "select COUNT(*) from WS_INV_DET where WS_INV_ID = " + _DetailID + " and GL_ACCOUNT is null"; if (Convert.ToInt32(Connection.SQLExecutor.ExecuteScalar(sSelect, Connection.TRConnection)) > 0) { bValid = false; xtraTabControl1.SelectedTabPageIndex = 1; sMessage = "All detail records require a GL Account before this request can be approved."; goto Error; } Error: if (!bValid) { Popup.ShowPopup(sMessage); } return(bValid); }
private void btnSearch_Click(object sender, EventArgs e) { bool bFieldsEmpty = true; daSearch.SelectCommand.Parameters["@supplier_id"].Value = DBNull.Value; if (!cboSupp.Text.Trim().Equals("")) { bFieldsEmpty = false; daSearch.SelectCommand.Parameters["@supplier"].Value = cboSupp.Text.Replace("'", "''"); } else { daSearch.SelectCommand.Parameters["@supplier"].Value = DBNull.Value; } if (!cboName.Text.Trim().Equals("")) { bFieldsEmpty = false; daSearch.SelectCommand.Parameters["@name"].Value = cboName.Text.Replace("'", "''"); } else { daSearch.SelectCommand.Parameters["@name"].Value = DBNull.Value; } if (lueCode.EditValue != null && lueCode.EditValue != DBNull.Value) { bFieldsEmpty = false; daSearch.SelectCommand.Parameters["@insur_type_id"].Value = lueCode.EditValue; } else { daSearch.SelectCommand.Parameters["@insur_type_id"].Value = DBNull.Value; } if (lueDesc.EditValue != null && lueDesc.EditValue != DBNull.Value) { bFieldsEmpty = false; daSearch.SelectCommand.Parameters["@insur_type_id2"].Value = lueDesc.EditValue; } else { daSearch.SelectCommand.Parameters["@insur_type_id2"].Value = DBNull.Value; } if (deFrom.EditValue != null && deFrom.EditValue != DBNull.Value) { bFieldsEmpty = false; daSearch.SelectCommand.Parameters["@expiry_from"].Value = deFrom.EditValue; } else { daSearch.SelectCommand.Parameters["@expiry_from"].Value = DBNull.Value; } if (deTo.EditValue != null && deTo.EditValue != DBNull.Value) { bFieldsEmpty = false; daSearch.SelectCommand.Parameters["@expiry_to"].Value = deTo.EditValue; } else { daSearch.SelectCommand.Parameters["@expiry_to"].Value = DBNull.Value; } //no search for project ATB daSearch.SelectCommand.Parameters["@pri_id"].Value = DBNull.Value; if (bFieldsEmpty) { if (Popup.ShowPopup("Search criteria is empty, are you sure you would like to perform search?", frmPopup.PopupType.OK_Cancel) == frmPopup.PopupResult.OK) { CL_Dialog.PleaseWait.Show("Loading Supplier's...", null); dsSearch1.Clear(); daSearch.Fill(dsSearch1); CL_Dialog.PleaseWait.Hide(); } } else { CL_Dialog.PleaseWait.Show("Loading Supplier's...", null); dsSearch1.Clear(); daSearch.Fill(dsSearch1); CL_Dialog.PleaseWait.Hide(); } }