private void MenuVisibility(bool State) { string strMenuName = string.Empty; strSQL = "SELECT MENU_NAME " + "FROM MST_MENU " + "WHERE MENU_VISIBILITY = 0"; DataSet dsMenuVisibility = dmlService.J_ExecSqlReturnDataSet(strSQL); if (dsMenuVisibility == null) { return; } if (dsMenuVisibility.Tables[0].Rows.Count > 0) { for (int intCount = 0; intCount < dsMenuVisibility.Tables[0].Rows.Count; intCount++) { strMenuName = dsMenuVisibility.Tables[0].Rows[intCount][0].ToString(); // Normal Masters Menu if (strMenuName == mnuMUser.Name) { mnuMUser.Visible = State; } } } dsMenuVisibility.Dispose(); }
public bool J_ShowDataInHelpGrid(string SqlText, string[,] arrColumns) { if (this.dsData != null) { this.dsData.Clear(); } this.dsData = dml.J_ExecSqlReturnDataSet(SqlText); if (this.dsData == null) { return(false); } this.dgrdHelpGrid.DataSource = this.dsData.Tables[0]; this.J_setCustomHelpGridColumn(this.dsData, arrColumns); return(true); }
private void BtnOK_Click(object sender, EventArgs e) { try { // Check the Validation if (ValidateFields() == false) { return; } // Make the query string for Company Information strSQL = "SELECT " + cmnService.J_SQLDBFormat("MST_SETUP.BRANCH_ID", J_ColumnType.Integer, J_SQLColFormat.NullCheck) + " AS BRANCH_ID," + " " + cmnService.J_SQLDBFormat("MST_SETUP.BRANCH_CODE", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS BRANCH_CODE," + " " + cmnService.J_SQLDBFormat("MST_SETUP.BRANCH_NAME", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS BRANCH_NAME," + " " + cmnService.J_SQLDBFormat("MST_SETUP.COMPANY_NAME", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS COMPANY_NAME," + " " + cmnService.J_SQLDBFormat("MST_SETUP.ADDRESS", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS ADDRESS," + " " + cmnService.J_SQLDBFormat("MST_SETUP.START_DATE", J_ColumnType.Date, J_SQLColFormat.DateFormatDDMMYYYY) + " AS START_DATE," + " " + cmnService.J_SQLDBFormat("MST_SETUP.SAVE_CONFIRMATION_MSG", J_ColumnType.Integer, J_SQLColFormat.NullCheck) + " AS SAVE_CONFIRMATION_MSG," + " " + cmnService.J_SQLDBFormat("MST_SETUP.NETWORK_CREDENTIAL_USERNAME", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS NETWORK_CREDENTIAL_USERNAME," + " " + cmnService.J_SQLDBFormat("MST_SETUP.NETWORK_CREDENTIAL_PASSWORD", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS NETWORK_CREDENTIAL_PASSWORD," + " " + cmnService.J_SQLDBFormat("MST_SETUP.NETWORK_CREDENTIAL_PORT", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS NETWORK_CREDENTIAL_PORT," + " " + cmnService.J_SQLDBFormat("MST_SETUP.NETWORK_CREDENTIAL_HOST", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS NETWORK_CREDENTIAL_HOST, " + " " + cmnService.J_SQLDBFormat("MST_SETUP.SMS_WORKING_KEY", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS SMS_WORKING_KEY, " + " " + cmnService.J_SQLDBFormat("MST_SETUP.SMS_OFFLINE_INVOICE_MESSAGE", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS SMS_OFFLINE_INVOICE_MESSAGE, " + " " + cmnService.J_SQLDBFormat("MST_SETUP.SMS_ONLINE_INVOICE_MESSAGE", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS SMS_ONLINE_INVOICE_MESSAGE, " + " " + cmnService.J_SQLDBFormat("MST_SETUP.SMS_SENDER_NAME", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS SMS_SENDER_NAME " + "FROM MST_SETUP " + "WHERE MST_SETUP.BRANCH_ID = " + J_Var.J_pBranchId + ""; // return the data reader as per above query string this.reader = dmlService.J_ExecSqlReturnReader(strSQL); // check the given reader is null if (reader == null) { cmbLoginId.Select(); return; } // fetch the data from reader while (reader.Read()) { J_Var.J_pBranchId = Convert.ToInt32(Convert.ToString(reader["BRANCH_ID"])); J_Var.J_pBranchCode = Convert.ToString(reader["BRANCH_CODE"]); J_Var.J_pBranchName = Convert.ToString(reader["BRANCH_NAME"]); J_Var.J_pCompanyName = Convert.ToString(reader["COMPANY_NAME"]); J_Var.J_pBranchAddress = Convert.ToString(reader["ADDRESS"]); J_Var.J_pSoftwareStartDate = Convert.ToString(reader["START_DATE"]); J_Var.J_pSaveConfirmMsg = Convert.ToInt32(Convert.ToString(reader["SAVE_CONFIRMATION_MSG"])); //ADDED BY DHRUB ON 31/01/2015 FOR SEND EMAIL AGAINST IVOICE J_Var.J_pNetworkCredential_Username = Convert.ToString(Convert.ToString(reader["NETWORK_CREDENTIAL_USERNAME"])); J_Var.J_pNetworkCredential_Password = Convert.ToString(Convert.ToString(reader["NETWORK_CREDENTIAL_PASSWORD"])); J_Var.J_pNetworkCredential_Port = Convert.ToString(Convert.ToString(reader["NETWORK_CREDENTIAL_PORT"])); J_Var.J_pNetworkCredential_Host = Convert.ToString(Convert.ToString(reader["NETWORK_CREDENTIAL_HOST"])); //ADDED BY DHRUB ON 31/01/2015 FOR SEND EMAIL AGAINST IVOICE J_Var.J_pSMS_WorkingKey = Convert.ToString(Convert.ToString(reader["SMS_WORKING_KEY"])); J_Var.J_pOfflineInvoiceSMS_Text = Convert.ToString(Convert.ToString(reader["SMS_OFFLINE_INVOICE_MESSAGE"])); J_Var.J_pOnlineInvoiceSMS_Text = Convert.ToString(Convert.ToString(reader["SMS_ONLINE_INVOICE_MESSAGE"])); J_Var.J_pSMS_SenderName = Convert.ToString(Convert.ToString(reader["SMS_SENDER_NAME"])); } // reader is closed & disposed this.reader.Close(); this.reader.Dispose(); // Make the query string strSQL = "SELECT USER_ID," + " DISPLAY_NAME," + " USER_CATEGORY " + "FROM MST_USER " + "WHERE " + cmnService.J_SQLDBFormat("LOGIN_ID", J_SQLColFormat.UCase) + " = '" + cmnService.J_ReplaceQuote(cmbLoginId.Text.ToUpper().Trim()) + "' " + "AND USER_PASSWORD = '******' "; if (cmbLoginId.Text.ToUpper() != "ADMIN") { strSQL = strSQL + "AND BRANCH_ID = " + J_Var.J_pBranchId + " "; } // return the dataset as per above query string DataSet ds = dmlService.J_ExecSqlReturnDataSet(strSQL); // check the given dataset is null if (ds == null) { cmbLoginId.Select(); return; } if (ds.Tables[0].Rows.Count > 0) { J_Var.J_pUserId = Convert.ToInt32(Convert.ToString(ds.Tables[0].Rows[0][0])); J_Var.J_pLoginId = cmnService.J_ReplaceQuote(cmbLoginId.Text.ToUpper().Trim()); J_Var.J_pUserDisplayName = Convert.ToString(ds.Tables[0].Rows[0][1]); J_Var.J_pUserCategory = Convert.ToInt32(Convert.ToString(ds.Tables[0].Rows[0][2])); // Close & Dispose the MstLogin Class dmlService.Dispose(); this.Close(); this.Dispose(); if (J_Var.J_pLoginStatus == 1) { J_Var.frmMain.Close(); J_Var.frmMain.Dispose(); } Hashtable nameValue = new Hashtable(); nameValue.Add("BRANCHINFO", J_Var.J_pBranchCode); XMLService objxml = new XMLService(); objxml.J_CreateXMLFile(nameValue, Application.StartupPath + "/" + J_Var.J_pXmlBranchInfoFileName, "BRANCHINFO"); // Create object of MDI Class J_Var.frmMain = new mdiBillingSystem(); J_Var.frmMain.ShowDialog(); } else { cmbLoginId.Select(); } } catch (Exception err_handler) { this.reader.Close(); this.reader.Dispose(); cmnService.J_UserMessage(err_handler.Message); cmbLoginId.Select(); } }
private void BtnSave_Click(object sender, EventArgs e) { // Transaction is started dmlService.J_BeginTransaction(); // report file object ReportClass rptcls; crInvoice rptInvoice = new crInvoice(); rptcls = (ReportClass)rptInvoice; // Temp Table Name string strTableName = "TMP_InvoiceType_" + J_Var.J_pUserId + "_" + string.Format("{0:ddMMyy}", System.DateTime.Now.Date) + "_" + string.Format("{0:HHmmss}", System.DateTime.Now); // Create the report temp table strSQL = "CREATE TABLE " + strTableName + "(" + " " + cmnService.J_GetDataType("INVOICE_TYPE_ID", J_ColumnType.Long) + "," + " " + cmnService.J_GetDataType("INVOICE_TYPE", J_ColumnType.String, 50) + "," + " " + cmnService.J_GetDataType("PRINT_TYPE", J_ColumnType.Integer) + ")"; if (dmlService.J_ExecSql(strSQL, J_SQLType.DDL) == false) { return; } // print type int intPrintType = 0; if (rbnSort1_2.Checked == true) { intPrintType = 1; } // invoice type //Added by Shrey Kejriwal on 05/08/2011 if (chkBox1.Checked == true) { strSQL = "INSERT INTO " + strTableName + " (INVOICE_TYPE_ID, INVOICE_TYPE , PRINT_TYPE) " + " VALUES (1 , '" + cmnService.J_ReplaceQuote("(Original - Buyer's Copy)") + "', " + intPrintType + ")"; if (dmlService.J_ExecSql(strSQL) == false) { return; } } if (chkBox2.Checked == true) { strSQL = "INSERT INTO " + strTableName + " (INVOICE_TYPE_ID, INVOICE_TYPE , PRINT_TYPE) " + " VALUES (2 , '(Duplicate Copy)', " + intPrintType + ")"; if (dmlService.J_ExecSql(strSQL) == false) { return; } } if (chkBox3.Checked == true) { strSQL = "INSERT INTO " + strTableName + " (INVOICE_TYPE_ID, INVOICE_TYPE , PRINT_TYPE) " + " VALUES (3 , '(Office Copy)', " + intPrintType + ")"; if (dmlService.J_ExecSql(strSQL) == false) { return; } } #region COMMENTED //Commented by Shrey Kejriwal on 05/08/2011 //if (rbnSort1.Checked == true) //{ // strSQL = "INSERT INTO " + strTableName + " (INVOICE_TYPE_ID, INVOICE_TYPE , PRINT_TYPE) " + // " VALUES (1 , '" + cmnService.J_ReplaceQuote("(Original - Buyer's Copy)") + "', " + intPrintType + ")"; // if (dmlService.J_ExecSql(strSQL) == false) return; // strSQL = "INSERT INTO " + strTableName + " (INVOICE_TYPE_ID, INVOICE_TYPE , PRINT_TYPE) " + // " VALUES (2 , '(Duplicate Copy)', " + intPrintType + ")"; // if (dmlService.J_ExecSql(strSQL) == false) return; // strSQL = "INSERT INTO " + strTableName + " (INVOICE_TYPE_ID, INVOICE_TYPE , PRINT_TYPE) " + // " VALUES (3 , '(Office Copy)', " + intPrintType + ")"; // if (dmlService.J_ExecSql(strSQL) == false) return; //} //else if (rbnSort2.Checked == true) //{ // strSQL = "INSERT INTO " + strTableName + " (INVOICE_TYPE_ID, INVOICE_TYPE , PRINT_TYPE) " + // " VALUES (1 , '" + cmnService.J_ReplaceQuote("(Original - Buyer's Copy)") + "', " + intPrintType + ")"; // if (dmlService.J_ExecSql(strSQL) == false) return; //} //else if (rbnSort3.Checked == true) //{ // strSQL = "INSERT INTO " + strTableName + " (INVOICE_TYPE_ID, INVOICE_TYPE , PRINT_TYPE) " + // " VALUES (2 , '(Duplicate Copy)', " + intPrintType + ")"; // if (dmlService.J_ExecSql(strSQL) == false) return; //} //else if (rbnSort4.Checked == true) //{ // strSQL = "INSERT INTO " + strTableName + " (INVOICE_TYPE_ID, INVOICE_TYPE , PRINT_TYPE) " + // " VALUES (3 , '(Office Copy)', " + intPrintType + ")"; // if (dmlService.J_ExecSql(strSQL) == false) return; //} #endregion // strSQL = "SELECT " + strTableName + ".INVOICE_TYPE_ID AS INVOICE_TYPE_ID," + " " + strTableName + ".INVOICE_TYPE AS INVOICE_TYPE," + " " + strTableName + ".PRINT_TYPE AS PRINT_TYPE," + " TRN_INVOICE_HEADER.INVOICE_HEADER_ID AS INVOICE_HEADER_ID," + " MST_INVOICE_SERIES.INVOICE_SERIES_ID AS INVOICE_SERIES_ID," + " MST_INVOICE_SERIES.HEADER_DISPLAY_TEXT AS HEADER_DISPLAY_TEXT," + " MST_PARTY.PARTY_NAME AS PARTY_NAME," + " MST_PARTY.ADDRESS1 AS ADDRESS1," + " MST_PARTY.ADDRESS2 AS ADDRESS2," + " MST_PARTY.ADDRESS3 AS ADDRESS3," + " MST_PARTY.CITY AS CITY," + " MST_PARTY.PIN AS PIN," + " MST_PARTY.MOBILE_NO AS MOBILE_NO," + " MST_PARTY.PHONE_NO AS PHONE_NO," + " MST_PARTY.FAX AS FAX," + " MST_PARTY.CONTACT_PERSON AS CONTACT_PERSON," + " TRN_INVOICE_HEADER.INVOICE_NO AS INVOICE_NO," + " TRN_INVOICE_HEADER.INVOICE_DATE AS INVOICE_DATE," + " TRN_INVOICE_HEADER.CHALLAN_REF_NO AS CHALLAN_REF_NO," + " TRN_INVOICE_HEADER.ORDER_NO AS ORDER_NO," + " TRN_INVOICE_HEADER.TOTAL_AMOUNT AS TOTAL_AMOUNT," + " TRN_INVOICE_HEADER.DISCOUNT_TEXT AS DISCOUNT_TEXT," + " TRN_INVOICE_HEADER.DISCOUNT_RATE AS DISCOUNT_RATE," + " TRN_INVOICE_HEADER.DISCOUNT_AMOUNT AS DISCOUNT_AMOUNT," + " TRN_INVOICE_HEADER.AMOUNT_WITH_DISCOUNT AS AMOUNT_WITH_DISCOUNT," + " TRN_INVOICE_HEADER.TAX_TOTAL_AMOUNT AS TAX_TOTAL_AMOUNT," + " TRN_INVOICE_HEADER.AMOUNT_WITH_TAX AS AMOUNT_WITH_TAX," + " TRN_INVOICE_HEADER.ADDITIONAL_COST_TEXT AS ADDITIONAL_COST_TEXT," + " TRN_INVOICE_HEADER.ADDITIONAL_COST AS ADDITIONAL_COST," + " TRN_INVOICE_HEADER.AMOUNT_WITH_ADDITIONAL_COST AS AMOUNT_WITH_ADDITIONAL_COST," + " TRN_INVOICE_HEADER.ROUNDED_OFF AS ROUNDED_OFF," + " TRN_INVOICE_HEADER.NET_AMOUNT AS NET_AMOUNT," + " TRN_INVOICE_HEADER.NET_AMOUNT_INWORDS AS NET_AMOUNT_INWORDS," + " MST_ITEM.ITEM_ID AS ITEM_ID," + " MST_ITEM.ITEM_NAME AS ITEM_NAME," + " TRN_INVOICE_DETAIL.QUANTITY AS QUANTITY," + " MST_ITEM.UNIT AS UNIT," + " TRN_INVOICE_DETAIL.RATE AS RATE," + " TRN_INVOICE_DETAIL.AMOUNT AS AMOUNT," + " TRN_INVOICE_DETAIL.REMARKS AS REMARKS," + " MST_COMPANY.COMPANY_ID AS COMPANY_ID," + " MST_COMPANY.COMPANY_NAME AS COMPANY_NAME," + " MST_COMPANY.ADDRESS1 AS COMPANY_ADDRESS1," + " MST_COMPANY.ADDRESS2 AS COMPANY_ADDRESS2," + " MST_COMPANY.ADDRESS3 AS COMPANY_ADDRESS3," + " MST_COMPANY.PIN AS COMPANY_PIN," + " MST_COMPANY.CONTACT_NO AS COMPANY_CONTACT_NO," + " MST_COMPANY.FAX AS COMPANY_FAX," + " MST_COMPANY.EMAIL_ID AS COMPANY_EMAIL_ID," + " MST_COMPANY.WEB_SITE AS COMPANY_WEB_SITE," + " MST_COMPANY.VAT_NO AS VAT_NO," + " MST_COMPANY.CST_NO AS CST_NO," + " MST_COMPANY.SERVICE_TAX_NO AS SERVICE_TAX_NO," + " MST_COMPANY.PAN AS PAN, " + " MST_COMPANY.CIN_NO AS CIN_NO," + " TRN_INVOICE_HEADER.DELIVERY_MARK AS DELIVERY_MARK," + " MST_COMPANY.BANK_DETAIL1 AS BANK_DETAIL1," + " MST_COMPANY.BANK_DETAIL2 AS BANK_DETAIL2," + " MST_COMPANY.BANK_DETAIL3 AS BANK_DETAIL3," + " MST_COMPANY.BANK_DETAIL4 AS BANK_DETAIL4," + " MST_COMPANY.BANK_DETAIL5 AS BANK_DETAIL5 " + "FROM TRN_INVOICE_HEADER," + " TRN_INVOICE_DETAIL," + " MST_INVOICE_SERIES," + " MST_COMPANY," + " MST_PARTY," + " MST_ITEM," + " " + strTableName + " " + "WHERE TRN_INVOICE_HEADER.INVOICE_HEADER_ID = TRN_INVOICE_DETAIL.INVOICE_HEADER_ID " + "AND TRN_INVOICE_HEADER.INVOICE_SERIES_ID = MST_INVOICE_SERIES.INVOICE_SERIES_ID " + "AND TRN_INVOICE_HEADER.COMPANY_ID = MST_COMPANY.COMPANY_ID " + "AND TRN_INVOICE_HEADER.PARTY_ID = MST_PARTY.PARTY_ID " + "AND TRN_INVOICE_DETAIL.ITEM_ID = MST_ITEM.ITEM_ID " + "AND TRN_INVOICE_HEADER.INVOICE_HEADER_ID = " + lngInvoiceHeaderId + " " + "AND TRN_INVOICE_HEADER.BRANCH_ID = " + J_Var.J_pBranchId + " " + "ORDER BY " + strTableName + ".INVOICE_TYPE_ID," + " TRN_INVOICE_HEADER.INVOICE_NO"; // SUB REPORTS // FOR SUMMARY OF TAX DETAILS string strSubRptTaxDetails = "SELECT MST_TAX.TAX_ID AS TAX_ID," + " MST_TAX.TAX_DESC AS TAX_DESC," + " TRN_INVOICE_TAX.INVOICE_HEADER_ID AS INVOICE_HEADER_ID," + " TRN_INVOICE_TAX.TAX_RATE AS TAX_RATE," + " TRN_INVOICE_TAX.TAX_AMOUNT AS TAX_AMOUNT " + "FROM MST_TAX," + " TRN_INVOICE_TAX " + "WHERE MST_TAX.TAX_ID = TRN_INVOICE_TAX.TAX_ID " + "AND TRN_INVOICE_TAX.INVOICE_HEADER_ID = " + lngInvoiceHeaderId + " " + "AND MST_TAX.BRANCH_ID = " + J_Var.J_pBranchId + " " + "ORDER BY TRN_INVOICE_TAX.INVOICE_TAX_ID"; // Transaction is commited dmlService.J_Commit(); // POPULATE & DISPLAY SUB REPORT rptcls.OpenSubreport("crSubRptTaxSummary").SetDataSource(dmlService.J_ExecSqlReturnDataSet(strSubRptTaxDetails).Tables[0]); PictureObject objBlobFieldObject; objBlobFieldObject = (PictureObject)rptcls.ReportDefinition.Sections[2].ReportObjects["imgSignature"]; objBlobFieldObject.ObjectFormat.EnableSuppress = true; // report is executed DataSet ds = dmlService.J_ExecSqlReturnDataSet(strSQL); if (ds == null) { return; } rptService.J_PreviewReport(ref rptcls, this, ds, J_Var.J_pCompanyName, J_Var.J_pBranchAddress, "INVOICE"); // Drop the report temp table if (dmlService.J_ExecSql("DROP TABLE " + strTableName) == false) { return; } //-- }