Sir I am sharing the code here
i have define class here and getting value to each form here
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
/// <summary>
/// Summary description for MainClass
/// </summary>
public class MainClass
{
SqlConnection SqlCn;
SqlCommand SqlCm;
SqlDataReader SqlDr;
SqlDataAdapter SqlDa;
ConnectionState ConState;
public static string SqlQryClass;
public static string ConPathClass;
public static string ConString;
public static Boolean SmtpContectionStatusClass;
// End Connection and Sql Class
public static string FormEntryLevelClass;
public static string FormModifyLevelClass;
public static string FormReportLevelClass;
public static string FormReportExportLevelClass;
public static int FormNoClass;
public static int SpecialPermissionNoClass;
public static string SpecialPermissionNameClass;
public static int ModuleNoClass;
// End Form Vaiable
public static int MainCompanyCodeClass;
public static string MainCompanyNameClass;
public static string MainCompanyNickClass;
public static string MainCompanyTypeClass;
public static string CompanyActiveStatusClass;
public static string StdDatabaseNameClass;
public static string FullCompanyNameClass;
public static string SalesCurrencyNameClass;
public static string SalesCurrencyNameSecondClass;
public static string ServiceCurrencyNameClass;
public static string ServiceCurrencyNameSecondClass;
public static string CountryNameShortClass;
public static string CountryNameFullClass;
public static string CountryPhoneStdClass;
public static string LessPaymentLimitClass;
public static string CompanyTinNoClass;
public static string CompanyRcNoClass;
public static string CostingMethodClass;
// End Company Detail
public static int MainBranchCodeClass;
public static string MainBranchNameClass;
public static string MainBranchPhoneNoClass;
public static string Tax1NameClass;
public static string Tax2NameClass;
public static string Tax3NameClass;
public static string Tax4NameClass;
public static string TaxStandardClass;
public static double Tax1PerSalesClass;
public static double Tax2PerSalesClass;
public static double Tax3PerSalesClass;
public static double Tax4PerSalesClass;
public static double Tax1PerServiceClass;
public static double Tax2PerServiceClass;
public static double Tax3PerServiceClass;
public static double Tax4PerServiceClass;
public static double Tax1PerPartsClass;
public static double Tax2PerPartsClass;
public static double Tax3PerPartsClass;
public static double Tax4PerPartsClass;
public static double MaximumDiscountPercentClass;
public static double SubletPercentClass;
public static string RegionalClass;
public static string BranchAddress1Class;
public static string BranchAddress2Class;
public static string SalesCallTypeClass;
public static string BranchValidClass;
public static string MainBranchNickClass;
public static string MainLocationClass;
public static string DiscountPositionClass;
// End Branch Detail
public static int StaffIdClass;
public static string StaffCodeClass;
public static string StaffNameClass;
public static string StaffDepartmentNameClass;
public static string StaffDepartmentCodeClass;
public static string StaffJobProfileNameClass;
public static string StaffJobProfileCodeClass;
public static string StaffCategoryClass;
public static string StaffPhoneNoClass;
public static string StaffEmailIdClass;
public static string StaffActiveStatusClass;
public static string StaffCompanyNameClass;
public static string StaffBranchNameClass;
public static int StaffCompanyCodeClass;
public static int StaffBranchCodeClass;
// Staff Detail
public static string LoginNameClass;
public static int LoginIdClass;
public static string LoginEmailIdClass;
public static string LoginPhoneNoClass;
public static string LoginRoleClass;
//Login User Detail
public static string StaffLoginCompany;
public static string StaffLoginLocation;
public static string StaffLoginExpiryDate;
public static string StaffLoginDate;
public static string StaffLoginActiveStatus;
public static string StaffLoginUserName;
// End Staff Login Detail
public static string ProcNameClass;
public static Boolean TransactionStatusClass;
public static string EntryByClass;
public static int RowIdClass;
public static string TodateDateClass;
public static string TodateTimeClass;
public static int CurrentYearClass;
public static DateTime SqlServerDate;
public static string ApproveStatus;
public static int DocumentNoClass;
public static string DocumentNoDetailClass;
public static string DocumentDateClass;
public static string DeliveryDateClass;
public static string MessageTitle;
public static string SearchByValueString1;
public static string SearchByField;
public static int LastNoClass;
public static string ViewDocumentTypeClass; // Photo Or Passport
public static int EditEntryCodeClass;
public static string RequestedByEmailClass;
public static string RequestedByNameClass;
// End Other Vaiable
public static int CustomerCodeClass;
public static string CustomerNameClass;
public static string CustomerCodeDuplicateClass;
public static string CustomerTitleClass;
public static string CustomerIdentityClass;
public static string CustomerContactPersonNameClass;
public static string CustomerContactPersonDesignationClass;
public static string CustomerContactPersonPhoneNoClass;
public static string CustomerFirstNameClass;
public static string CustomerMiddleNameClass;
public static string CustomerLastNameClass;
public static string CustomerTypeClass;
public static string CustomerGroupClass;
public static string CustomerGenderClass;
public static string CustomerDOBClass;
public static string CustomerDOMClass;
public static string CustomerAddress1Class;
public static string CustomerAddress2Class;
public static string CustomerCityCodeClass;
public static int CustomerZipCodeClass;
public static string CustomerPBNoClass;
public static string CustomerStateCodeClass;
public static int CustomerCountryCodeClass;
public static string CustomerCountryNameClass;
public static string CustomerPhoneNoClass;
public static string CustomerMobileNoClass;
public static string CustomerEmailIdClass;
public static string CustomerActiveStatusClass;
public static string CustomerCreditLimitStatusClass;
public static string CustomerTaxCategoryClass;
public static string CustomerTaxIDClass;
public static string CustomerVatNoClass;
public static string CustomerTinNoClass;
public static Boolean CustomerFoundClass;
public static string ContactPersonNameShipClass;
public static string ContactPersonDesignationShipClass;
public static string ContactPersonPhoneNoClass;
public static string ContactPersonEmailIdClass;
public static int AddressCodeClass;
public static string Address1ShipClass;
public static string Address2ShipClass;
public static string CityCodeShipClass;
public static string CityNameShipClass;
public static string PBNoShipClass;
public static string GenderShipClass;
public static string StateCodeShipClass;
public static string StateNameShipClass;
public static string MobileNoShipClass;
public static string EmailIdShipClass;
public static double CustomerBalanceClass;
// End Customer Vaiable
public static int SupplierCodeClass;
public static string SupplierNameClass;
public static string SupplierContactPersonNameClass;
public static string SupplierContactPersonPhoneNoClass;
public static string SupplierAddress1Class;
public static string SupplierAddress2Class;
public static string SupplierTypeClass;
public static string SupplierTinNoClass;
public static string SupplierVatNoClass;
public static string SupplierTaxIdClass;
public static string SupplierPhoneNoClass;
public static string SupplierMobileNoClass;
public static string SupplierEmailIdClass;
// End Suppler
public static string RegNoClass;
public static string ChassisNoClass;
public static int BrandCodeClass;
public static string BrandNameClass;
public static string BrandNickNameClass;
public static int ModelGroupCodeClass;
public static string ModelGroupNameClass;
public static int ModelCodeClass;
public static double EngineCapacityClass;
public static string ModelNameClass;
public static int ModelYearClass;
public static string ColourOEMCodeClass;
public static int ColourCodeClass;
public static string ColourNameClass;
public static string EngineNoClass;
public static string TransmissionClass;
public static string KeyCodeClass;
public static string RadioCodeClass;
public static string SaleTypeClass;
public static int MileageClass;
public static string SpecsClass;
public static double ModelRetailPriceClass;
public static double ModelSalesPriceClass;
public static double ModelManagementPriceClass;
public static string ModelCurrencyClass;
public static string SoldDateClass;
public static string DeliveryNoteNoClass;
public static string LoyaltyCardNoClass;
// End Vehcile Vaiable
//------------------- Customer
public static string InvoiceNoDetailClass;
public static string InvoiceDateClass;
public static string InvoiceStatusClass;
public static double PartsAmountClass;
public static double LabourAmountClass;
public static double TotalAmountClass;
public static double DiscountAmountPartsClass;
public static double DiscountAmountLabourClass;
public static double DiscountAmountClass;
public static double Tax1AmountPartsClass;
public static double Tax2AmountPartsClass;
public static double Tax3AmountPartsClass;
public static double Tax1AmountServiceClass;
public static double Tax2AmountServiceClass;
public static double Tax3AmountServiceClass;
public static double TaxAmountClass;
public static double NetAmountClass;
public static string InvoiceCancelStatusClass;
public static string InvoiceTypeNameClass;
public static string InvoiceTypeCodeClass;
public static string InvoiceCancelDateClass;
public static string InvoiceCancelRemarkClass;
public static string InvoiceRemarkClass;
public static string PaymentModeClass;
//---- Supplier
public static string TransactionDateClass;
public static double InvoiceAmountClass;
public static double PaidAmountClass;
public static double BalanceAmountClass;
public static double CreditNoteAmountClass;
public static double DebitNoteAmountClass;
public static string TransactionDetailsClass;
public static string DocumentDetailClass;
public static string TransactionTypeClass;
public static string TransactionIdClass;
// End Customer / Suplier Invoice
public static string JobNoDetailClass;
// End JobCard
public static string CurrencyNameClass;
public static double ExchangeRateClass;
public static string BalanceTypeClass;
// End Other Valiable
public static string TCDetailClass;
public static string BankNameClass;
public static string AccountNoClass;
public static string BankCodeClass;
// End Bank
public static string DealTypeClass;
public static string RegistrationClass;
public static string PaymentTermsClass;
public static string TaxOptionClass;
public static string TaxApplyClass;
public static double BasePriceClass;
public static double UnitPriceClass;
public static double QtyClass;
public static double AmountClass;
public static double LessDiscountClass;
public static double AddOtherChargesClass;
//public static double SubTotalClass;
//public static double TotalClass;
public static double Tax1PerClass;
public static double Tax2PerClass;
public static double Tax3PerClass;
public static double Tax4PerClass;
public static double Tax1AmountClass;
public static double Tax2AmountClass;
public static double Tax3AmountClass;
public static double Tax4AmountClass;
//public static double GrandTotal;
// End PI Variable
public static string CurrencyNameSecondClass;
public static string CurrencyNameTmpClass;
public static string CurrencyNameFCClass;
public static string CurrencyFormatStdClass; // Asia
public static double CurrencyExchangeRateClass;
public static string RegionalStatusClass;
public static string MultipleCurrencyClass;
public static string PiDetailClass;
public static string OrderDetailClass;
public static DateTime OrderDateClass;
public static string OrderStatusClass;
public static string RemarkClass;
//public static string StandradCurrencyNameSalesFirstClass;
//public static string StandradCurrencyNameSalesSecondClass;
//public static string StandardCurrencyNameServiceFirstClass;
//public static string StandardCurrencyNameServiceSecondClass;
public static string AppliedCurrencyNameFirstClass;
public static string AppliedCurrencyNameSecondClass;
public static string CurrencyNameForExchangeRateClass;
public static string CurrencyTypeClass;
public static int CurrencyCalculationClass;
public static double ExchangeRateTmpClass;
// End Currecy Variable
public static int COALedgerHead1Class;
public static int COALedgerHead2Class;
public static string COALedgerCodeClass;
public static string COALedgerNameClass;
// End COA LEDGER ACCOUNT
public static string StaffImgClass;
public static double SrNoClass;
public static string PrintVoucherTitle;
public static string DbFieldNameImgClass;
public static string DbFieldNameAmtClass;
public static string ViewPersonTypeClass; // Family or Staff
// Convert To Word
string Number;
string deciml;
string _number;
string _deciml;
string[] US = new string[1003];
string[] SNu = new string[20];
string[] SNt = new string[10];
string ValueInWordClass;
// End Convert To Word
public int GetLastEntryNoClass()
{
try
{
GetConnectionForClass();
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand(SqlQryClass, SqlCn);
SqlCm.CommandType = CommandType.Text;
//SqlCm.Parameters.AddWithValue("StaffCode", StaffCode);
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.HasRows)
{
if (SqlDr.Read())
{
LastNoClass = int.Parse(SqlDr["LastNo"].ToString());
}
}
else
{
LastNoClass = 100;
}
if (LastNoClass == 0)
{
LastNoClass = 100;
}
LastNoClass = LastNoClass + 1;
}
// End Try
catch (Exception ex)
{
//MessageTitle = " Error Get Last No " + ex.ToString();
////MessageScript();
//MessageScriptWithUpdatePanel();
//return;
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return LastNoClass;
}
// End Get Last Entry No
public Boolean CheckDuplicateLastNo()
{
try
{
GetConnectionForClass();
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand(SqlQryClass, SqlCn);
SqlCm.CommandType = CommandType.Text;
//SqlCm.Parameters.AddWithValue("StaffCode", StaffCode);
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.HasRows)
{
TransactionStatusClass = false;
}
else
{
TransactionStatusClass = true;
//LastNoClass = LastNoClass + 1;
}
}
// End Try
catch (Exception ex)
{
//MessageTitle = " Error Get Last No " + ex.ToString();
////MessageScript();
//MessageScriptWithUpdatePanel();
//return;
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return TransactionStatusClass;
}
public Boolean CheckDuplicateVehicle()
{
try
{
GetConnectionForClass();
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand(SqlQryClass, SqlCn);
SqlCm.CommandType = CommandType.Text;
//SqlCm.Parameters.AddWithValue("StaffCode", StaffCode);
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.Read())
{
if (int.Parse(SqlDr["DuplicateCount"].ToString()) > 0)
{
int value = int.Parse(SqlDr["DuplicateCount"].ToString());
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = false;
}
}
else
{
TransactionStatusClass = false;
//LastNoClass = LastNoClass + 1;
}
}
// End Try
catch (Exception ex)
{
//MessageTitle = " Error Get Last No " + ex.ToString();
////MessageScript();
//MessageScriptWithUpdatePanel();
//return;
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return TransactionStatusClass;
}
public string GetServerDate()
{
try
{
GetConnectionForClass();
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("Select convert(varchar(20), getdate(),101) as ServerDate,CONVERT(VARCHAR(5),getdate(),108) as ServerTime ,year(getdate()) as CurrentYear ", SqlCn);
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.Read())
{
//DateTime oDate = DateTime.ParseExact(iString, "yyyy-MM-dd HH:mm tt", System.Globalization.CultureInfo.InvariantCulture);
TodateDateClass = SqlDr["ServerDate"].ToString();
TodateTimeClass = SqlDr["ServerTime"].ToString();
SqlServerDate = Convert.ToDateTime(TodateDateClass);
TodateDateClass = SqlServerDate.ToString("dd-MM-yyyy");
CurrentYearClass = int.Parse(SqlDr["CurrentYear"].ToString());
}
else
{
TodateDateClass = System.DateTime.Now.Date.ToString("dd-MM-yyyy");
}
}
// End Try
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return TodateDateClass;
}
// End GetServer Date
public string GetConnectionForClass()
{
//// Connection String From Class in Login Form
//// Start Connction String From Web confirm
//ConPathClass = ConfigurationManager.ConnectionStrings["Rs4uConWeb"].ConnectionString;
//// End Connection String from Web confirm
//TransactionStatusClass = false;
//try
//{
// SqlCn = new SqlConnection(ConPathClass);
// SqlCn.Open();
// ConState = SqlCn.State;
// SqlCn.Close();
// TransactionStatusClass = false;
//}
//catch (SqlException ex)
//{
// TransactionStatusClass = false;
//}
//finally
//{
// if (SqlCn.State == ConnectionState.Open)
// {
// TransactionStatusClass = true;
// SqlCn.Close();
// }
//}
//return ConString;
//============================================================
// Connection String From Class in Login Form
// Start Connction String From Web confirm
try
{
ConPathClass = ConfigurationManager.ConnectionStrings["Rs4uConWeb"].ConnectionString;
// End Connection String from Web confirm
SqlCn = new SqlConnection(ConPathClass);
SqlCn.Open();
ConState = SqlCn.State;
SqlCn.Close();
if (ConState == ConnectionState.Closed || ConState == ConnectionState.Broken)
{
//MessageTitle = "Sql Server Connection Failed";
//MessageScript();
TransactionStatusClass = false;
ConString = "";
return ConString;
}
else
{
//MessageTitle = "Sql Server Connection Sucess-2";
//MessageScript();
TransactionStatusClass = true;
ConString = MainClass.ConPathClass.ToString();
//return ConString;
}
}
catch (SqlException ex)
{
TransactionStatusClass = false;
}
finally
{
if (SqlCn.State == ConnectionState.Open)
{
TransactionStatusClass = true;
SqlCn.Close();
}
}
return ConString;
}
// End Connection for Class
public Boolean AccessFormClass(int LoginId, string FormNo, int ModuleNo)
{
try
{
GetConnectionForClass();
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("FormAccess", SqlCn); // PermissionForm
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("ApplicationType", "WEB");
SqlCm.Parameters.AddWithValue("UserId", LoginId);
SqlCm.Parameters.AddWithValue("FormNo", FormNo);
SqlCm.Parameters.AddWithValue("ModuleNo", ModuleNo);
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.Read())
{
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = false;
}
}
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return TransactionStatusClass;
}
// End Access Form
public Boolean StaffLoginDetailClass(int UserId)
{
try
{
GetConnectionForClass();
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("LoginDetailStatus", SqlCn); // PermissionForm
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("StaffId", UserId);
//SqlCm.Parameters.AddWithValue("UserName", UserName);
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.HasRows)
{
if (SqlDr.Read())
{
StaffLoginCompany = SqlDr["DefaultCompany"].ToString();
StaffLoginLocation = SqlDr["DefaultLocation"].ToString();
StaffLoginExpiryDate = SqlDr["ExpiryDate"].ToString();
StaffLoginDate = SqlDr["LoginDate"].ToString();
StaffLoginActiveStatus = SqlDr["ActiveStatus"].ToString();
StaffLoginUserName = SqlDr["LoginUserName"].ToString();
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = false;
}
// End Read
}
else
{
TransactionStatusClass = false;
}
// end has Row
}
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
}
// End Finally
return TransactionStatusClass;
}
// End Staff Login Detail
public Boolean GetStaffDetailClass(string StaffEmpCode)
{
try
{
GetConnectionForClass();
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("StaffDetail", SqlCn); // PermissionForm
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("StaffEmpCode", StaffEmpCode);
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.HasRows)
{
if (SqlDr.Read())
{
StaffIdClass = int.Parse(SqlDr["StaffId"].ToString());
StaffCodeClass = SqlDr["StaffCode"].ToString();
StaffNameClass = SqlDr["StaffName"].ToString();
StaffDepartmentNameClass = SqlDr["DepartmentName"].ToString();
StaffDepartmentCodeClass = SqlDr["DepartmentCode"].ToString();
StaffJobProfileNameClass = SqlDr["JobProfileName"].ToString();
StaffJobProfileCodeClass = SqlDr["JobProfileCode"].ToString();
StaffCategoryClass = SqlDr["StaffCategory"].ToString();
StaffPhoneNoClass = SqlDr["StaffPhoneNo"].ToString();
StaffEmailIdClass = SqlDr["StaffEmailId"].ToString();
StaffBranchNameClass = SqlDr["MainBranchName"].ToString();
StaffBranchCodeClass = int.Parse(SqlDr["MainBranchCode"].ToString());
StaffCompanyNameClass = SqlDr["MainCompanyName"].ToString();
StaffCompanyCodeClass = int.Parse(SqlDr["MainCompanyCode"].ToString());
StaffActiveStatusClass = SqlDr["StaffActiveStatus"].ToString();
TransactionStatusClass = true;
}
}
else
{
TransactionStatusClass = false;
}
}
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return TransactionStatusClass;
}
// End Staff Detail
public Boolean AccessSpecialPermissionClass(int LoginIdClass, string FormNoClass, int SpecialPermissionNoClass)
{
try
{
GetConnectionForClass();
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("SpecialPermissionAccess", SqlCn); // PermissionForm
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("ApplicationType", "WEB");
SqlCm.Parameters.AddWithValue("UserId", LoginIdClass);
SqlCm.Parameters.AddWithValue("FormNo", FormNoClass);
SqlCm.Parameters.AddWithValue("SpecialPermissionNo", SpecialPermissionNoClass);
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.Read())
{
SpecialPermissionNameClass = SqlDr["SpecialPermissionName"].ToString();
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = false;
}
}
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return TransactionStatusClass;
}
// End Special Permission
public Boolean GetDefaultCompanyBranchFromClass(string EmailId)
{
try
{
GetConnectionForClass(); // Function Call
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("GetDefaultCompanyBranch", SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("StaffEmailId", EmailId);
// SqlCm = new SqlCommand(SqlQryClass, SqlCn);
//SqlCm.CommandType = CommandType.Text;
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.HasRows)
{
if (SqlDr.Read())
{
LoginEmailIdClass = SqlDr["EmailId"].ToString();
LoginIdClass = int.Parse(SqlDr["StaffId"].ToString());
LoginNameClass = SqlDr["StaffName"].ToString();
LoginPhoneNoClass = SqlDr["StaffPhoneNo"].ToString();
LoginRoleClass = SqlDr["StaffRole"].ToString();
// End Login
MainCompanyCodeClass = int.Parse(SqlDr["MainCompanyCode"].ToString());
MainCompanyNameClass = SqlDr["MainCompanyName"].ToString();
MainCompanyNickClass = SqlDr["MainCompanyNick"].ToString();
MainCompanyTypeClass = SqlDr["MainCompanyType"].ToString();
CompanyActiveStatusClass = SqlDr["ActiveStatus"].ToString();
StdDatabaseNameClass = SqlDr["StdDatabaseName"].ToString();
FullCompanyNameClass = SqlDr["FullCompanyName"].ToString();
SalesCurrencyNameClass = SqlDr["SalesCurrencyName"].ToString();
SalesCurrencyNameSecondClass = SqlDr["SalesCurrencyNameSecond"].ToString();
ServiceCurrencyNameClass = SqlDr["ServiceCurrencyName"].ToString();
ServiceCurrencyNameSecondClass = SqlDr["ServiceCurrencyNameSecond"].ToString();
CountryNameShortClass = SqlDr["CountryNameShort"].ToString();
CountryNameFullClass = SqlDr["CountryNameFull"].ToString();
CountryPhoneStdClass = SqlDr["CountryPhoneStd"].ToString();
LessPaymentLimitClass = SqlDr["LessPaymentLimit"].ToString();
CompanyTinNoClass = SqlDr["CompanyTinNo"].ToString();
CompanyRcNoClass = SqlDr["CompanyRcNo"].ToString();
CostingMethodClass = SqlDr["CostingMethod"].ToString();
// End Comapny
MainBranchCodeClass = int.Parse(SqlDr["MainBranchCode"].ToString());
MainBranchNameClass = SqlDr["MainBranchName"].ToString();
MainBranchPhoneNoClass = SqlDr["mainbranchphoneno"].ToString();
Tax1NameClass = SqlDr["Tax1Name"].ToString();
Tax2NameClass = SqlDr["Tax2Name"].ToString();
Tax3NameClass = SqlDr["Tax3Name"].ToString();
Tax4NameClass = SqlDr["Tax4Name"].ToString();
TaxStandardClass = SqlDr["TaxStandard"].ToString();
Tax1PerSalesClass = double.Parse(SqlDr["Tax1PerSales"].ToString());
Tax2PerSalesClass = double.Parse(SqlDr["Tax2PerSales"].ToString());
Tax3PerSalesClass = double.Parse(SqlDr["Tax3PerSales"].ToString());
Tax4PerSalesClass = double.Parse(SqlDr["Tax4PerSales"].ToString());
Tax1PerServiceClass = double.Parse(SqlDr["Tax1PerService"].ToString());
Tax2PerServiceClass = double.Parse(SqlDr["Tax2PerService"].ToString());
Tax3PerServiceClass = double.Parse(SqlDr["Tax3PerService"].ToString());
Tax4PerServiceClass = double.Parse(SqlDr["Tax4PerService"].ToString());
Tax1PerPartsClass = double.Parse(SqlDr["Tax1PerParts"].ToString());
Tax2PerPartsClass = double.Parse(SqlDr["Tax2PerParts"].ToString());
Tax3PerPartsClass = double.Parse(SqlDr["Tax3PerParts"].ToString());
Tax4PerPartsClass = double.Parse(SqlDr["Tax4PerParts"].ToString());
MaximumDiscountPercentClass = double.Parse(SqlDr["MaximumDiscountPercent"].ToString());
SubletPercentClass = double.Parse(SqlDr["SubletPercent"].ToString());
RegionalClass = SqlDr["Regional"].ToString();
BranchAddress1Class = SqlDr["BranchAddress1"].ToString();
BranchAddress2Class = SqlDr["BranchAddress2"].ToString();
SalesCallTypeClass = SqlDr["SalesCallType"].ToString();
BranchValidClass = SqlDr["BranchValid"].ToString();
MainBranchNickClass = SqlDr["MainBranchNick"].ToString();
MainLocationClass = SqlDr["MainLocation"].ToString();
DiscountPositionClass = SqlDr["DiscountPosition"].ToString();
// End Branch Detail
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = false;
}
}
}
// End Try
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return TransactionStatusClass;
}
// End Get Default Company and Location
public Boolean GetNewCompanyBranchDetailFromClass(int BranchCode)
{
try
{
GetConnectionForClass(); // Function Call
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("GetCompanyBranch", SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("MainBranchCode", BranchCode);
// SqlCm = new SqlCommand(SqlQryClass, SqlCn);
//SqlCm.CommandType = CommandType.Text;
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.HasRows)
{
if (SqlDr.Read())
{
MainCompanyCodeClass = int.Parse(SqlDr["MainCompanyCode"].ToString());
MainCompanyNameClass = SqlDr["MainCompanyName"].ToString();
MainCompanyNickClass = SqlDr["MainCompanyNick"].ToString();
MainCompanyTypeClass = SqlDr["MainCompanyType"].ToString();
CompanyActiveStatusClass = SqlDr["ActiveStatus"].ToString();
StdDatabaseNameClass = SqlDr["StdDatabaseName"].ToString();
FullCompanyNameClass = SqlDr["FullCompanyName"].ToString();
SalesCurrencyNameClass = SqlDr["SalesCurrencyName"].ToString();
SalesCurrencyNameSecondClass = SqlDr["SalesCurrencyNameSecond"].ToString();
ServiceCurrencyNameClass = SqlDr["ServiceCurrencyName"].ToString();
ServiceCurrencyNameSecondClass = SqlDr["ServiceCurrencyNameSecond"].ToString();
CountryNameShortClass = SqlDr["CountryNameShort"].ToString();
CountryNameFullClass = SqlDr["CountryNameFull"].ToString();
CountryPhoneStdClass = SqlDr["CountryPhoneStd"].ToString();
LessPaymentLimitClass = SqlDr["LessPaymentLimit"].ToString();
CompanyTinNoClass = SqlDr["CompanyTinNo"].ToString();
CompanyRcNoClass = SqlDr["CompanyRcNo"].ToString();
CostingMethodClass = SqlDr["CostingMethod"].ToString();
// End Comapny
MainBranchCodeClass = int.Parse(SqlDr["MainBranchCode"].ToString());
MainBranchNameClass = SqlDr["MainBranchName"].ToString();
MainBranchPhoneNoClass = SqlDr["mainbranchphoneno"].ToString();
Tax1NameClass = SqlDr["Tax1Name"].ToString();
Tax2NameClass = SqlDr["Tax2Name"].ToString();
Tax3NameClass = SqlDr["Tax3Name"].ToString();
Tax4NameClass = SqlDr["Tax4Name"].ToString();
TaxStandardClass = SqlDr["TaxStandard"].ToString();
Tax1PerSalesClass = double.Parse(SqlDr["Tax1PerSales"].ToString());
Tax2PerSalesClass = double.Parse(SqlDr["Tax2PerSales"].ToString());
Tax3PerSalesClass = double.Parse(SqlDr["Tax3PerSales"].ToString());
Tax4PerSalesClass = double.Parse(SqlDr["Tax4PerSales"].ToString());
Tax1PerServiceClass = double.Parse(SqlDr["Tax1PerService"].ToString());
Tax2PerServiceClass = double.Parse(SqlDr["Tax2PerService"].ToString());
Tax3PerServiceClass = double.Parse(SqlDr["Tax3PerService"].ToString());
Tax4PerServiceClass = double.Parse(SqlDr["Tax4PerService"].ToString());
Tax1PerPartsClass = double.Parse(SqlDr["Tax1PerParts"].ToString());
Tax2PerPartsClass = double.Parse(SqlDr["Tax2PerParts"].ToString());
Tax3PerPartsClass = double.Parse(SqlDr["Tax3PerParts"].ToString());
Tax4PerPartsClass = double.Parse(SqlDr["Tax4PerParts"].ToString());
MaximumDiscountPercentClass = double.Parse(SqlDr["MaximumDiscountPercent"].ToString());
SubletPercentClass = double.Parse(SqlDr["SubletPercent"].ToString());
RegionalClass = SqlDr["Regional"].ToString();
BranchAddress1Class = SqlDr["BranchAddress1"].ToString();
BranchAddress2Class = SqlDr["BranchAddress2"].ToString();
SalesCallTypeClass = SqlDr["SalesCallType"].ToString();
BranchValidClass = SqlDr["BranchValid"].ToString();
MainBranchNickClass = SqlDr["MainBranchNick"].ToString();
MainLocationClass = SqlDr["MainLocation"].ToString();
DiscountPositionClass = SqlDr["DiscountPosition"].ToString();
// End Branch Detail
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = false;
}
}
}
// End Try
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return TransactionStatusClass;
}
// End Company and Branch detail
// Start Customer detail
public Boolean CustomerDetailFromClass(int CustomerCode)
{
//try
//{
GetConnectionForClass(); // Function Call
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("CustomerDetail", SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("CustomerId", CustomerCode);
// SqlCm = new SqlCommand(SqlQryClass, SqlCn);
//SqlCm.CommandType = CommandType.Text;
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.HasRows)
{
if (SqlDr.Read())
{
CustomerTitleClass = SqlDr["Title"].ToString();
CustomerIdentityClass = SqlDr["CustomerIdentity"].ToString();
CustomerContactPersonNameClass = SqlDr["ContactPersonName"].ToString();
CustomerContactPersonDesignationClass = SqlDr["ContactPersonDesignation"].ToString();
CustomerContactPersonPhoneNoClass = SqlDr["ContactPersonPhoneNo"].ToString();
CustomerFirstNameClass = SqlDr["FirstName"].ToString();
CustomerMiddleNameClass = SqlDr["MiddleName"].ToString();
CustomerLastNameClass = SqlDr["LastName"].ToString();
CustomerNameClass = SqlDr["CustomerName"].ToString();
CustomerTypeClass = SqlDr["CustomerType"].ToString();
CustomerGroupClass = SqlDr["CustomerGroup"].ToString();
CustomerGenderClass = SqlDr["Gender"].ToString();
CustomerAddress1Class = SqlDr["Address1"].ToString();
CustomerAddress2Class = SqlDr["Address2"].ToString();
CustomerCityCodeClass = SqlDr["CityCode"].ToString();
CustomerPBNoClass = SqlDr["PBNo"].ToString();
CustomerStateCodeClass = SqlDr["StateCode"].ToString();
CustomerPhoneNoClass = SqlDr["PhoneNo"].ToString();
CustomerMobileNoClass = SqlDr["MobileNo"].ToString();
CustomerEmailIdClass = SqlDr["EmailId"].ToString();
CustomerActiveStatusClass = SqlDr["ActiveStatus"].ToString();
CustomerCreditLimitStatusClass = SqlDr["CreditLimitStatus"].ToString();
CustomerTaxCategoryClass = SqlDr["VatCategory"].ToString();
CustomerTaxIDClass = SqlDr["TaxID"].ToString();
CustomerVatNoClass = SqlDr["VatNo"].ToString();
CustomerTinNoClass = SqlDr["TinNo"].ToString();
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = false;
}
}
//}
//// End Try
//catch (Exception ex)
//{
// TransactionStatusClass = false;
//}
//// Catch
//finally
//{
// SqlCn.Close();
// //SqlCm.Dispose();
// //SqlDr.Dispose();
//}
//// End Finally
return TransactionStatusClass;
}
// End Customer detail
public Boolean CustomerShipAddressLastFromClass(int CustomerCode)
{
try
{
GetConnectionForClass(); // Function Call
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("CustomerShipingAddressLast", SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("CustomerId", CustomerCode);
// SqlCm = new SqlCommand(SqlQryClass, SqlCn);
//SqlCm.CommandType = CommandType.Text;
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.HasRows)
{
if (SqlDr.Read())
{
ContactPersonNameShipClass = SqlDr["ContactPersonName"].ToString();
ContactPersonDesignationShipClass = SqlDr["ContactPersonDesignation"].ToString();
MobileNoShipClass = SqlDr["MobileNo"].ToString();
EmailIdShipClass = SqlDr["EmailId"].ToString();
Address1ShipClass = SqlDr["Address1"].ToString();
Address2ShipClass = SqlDr["Address2"].ToString();
CityCodeShipClass = SqlDr["CityCode"].ToString();
CityNameShipClass = SqlDr["CityName"].ToString();
PBNoShipClass = SqlDr["PBNo"].ToString();
StateCodeShipClass = SqlDr["StateCode"].ToString();
StateNameShipClass = SqlDr["StateName"].ToString();
GenderShipClass = SqlDr["Gender"].ToString();
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = false;
}
}
}
// End Try
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return TransactionStatusClass;
}
// End Customer Last Address
public Boolean CustomerShipAddressDetailFromClass(int AddressId)
{
try
{
GetConnectionForClass(); // Function Call
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("CustomerShipingAddressDetail", SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("AddressId", AddressId);
// SqlCm = new SqlCommand(SqlQryClass, SqlCn);
//SqlCm.CommandType = CommandType.Text;
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.HasRows)
{
if (SqlDr.Read())
{
ContactPersonNameShipClass = SqlDr["ContactPersonName"].ToString();
ContactPersonDesignationShipClass = SqlDr["ContactPersonDesignation"].ToString();
MobileNoShipClass = SqlDr["MobileNo"].ToString();
EmailIdShipClass = SqlDr["EmailId"].ToString();
Address1ShipClass = SqlDr["Address1"].ToString();
Address2ShipClass = SqlDr["Address2"].ToString();
CityCodeShipClass = SqlDr["CityCode"].ToString();
CityNameShipClass = SqlDr["CityName"].ToString();
PBNoShipClass = SqlDr["PBNo"].ToString();
StateCodeShipClass = SqlDr["StateCode"].ToString();
StateNameShipClass = SqlDr["StateName"].ToString();
GenderShipClass = SqlDr["Gender"].ToString();
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = false;
}
}
}
// End Try
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return TransactionStatusClass;
}
// End Customer Ship Address Detail
public Boolean BrandDetailFromClass(int BrandCode)
{
try
{
GetConnectionForClass(); // Function Call
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("BrandDetail", SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("BrandCode", BrandCode);
// SqlCm = new SqlCommand(SqlQryClass, SqlCn);
//SqlCm.CommandType = CommandType.Text;
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.HasRows)
{
if (SqlDr.Read())
{
BrandNickNameClass = SqlDr["BrandNameNick"].ToString();
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = false;
}
}
}
// End Try
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return TransactionStatusClass;
}
// End Model detail
public Boolean GetPiDetailFromClass(string PiNo)
{
try
{
GetConnectionForClass(); // Function Call
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("ProformaDetail", SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("PrqDetail", PiNo);
SqlDr = SqlCm.ExecuteReader();
TransactionStatusClass = false;
if (SqlDr.HasRows)
{
if (SqlDr.Read())
{
OrderDetailClass = SqlDr["OrderDetail"].ToString();
BrandCodeClass = int.Parse(SqlDr["BrandCode"].ToString());
BrandNameClass = SqlDr["BrandName"].ToString();
ModelCodeClass = int.Parse(SqlDr["ModelCode"].ToString());
ModelNameClass = SqlDr["ModelName"].ToString();
TransmissionClass = SqlDr["Transmission"].ToString();
CustomerCodeClass = int.Parse(SqlDr["CustomerCode"].ToString());
CustomerNameClass = SqlDr["CustomerName"].ToString();
AddressCodeClass = int.Parse(SqlDr["AddressCode"].ToString());
ContactPersonNameShipClass = SqlDr["ContactPersonName"].ToString();
ContactPersonDesignationShipClass = SqlDr["ContactPersonDesignation"].ToString();
ContactPersonPhoneNoClass = SqlDr["ContactPersonPhoneNo"].ToString();
CustomerEmailIdClass = SqlDr["CustomerEmailId"].ToString();
CustomerAddress1Class = SqlDr["CustomerAddress1"].ToString();
CustomerAddress2Class = SqlDr["CustomerAddress2"].ToString();
DealTypeClass = SqlDr["DealType"].ToString();
RegistrationClass = SqlDr["Registration"].ToString();
TaxOptionClass = SqlDr["TaxOption"].ToString();
CustomerTaxCategoryClass = SqlDr["TaxCategory"].ToString();
PaymentTermsClass = SqlDr["PaymentTerms"].ToString();
TaxApplyClass = SqlDr["TaxApply"].ToString();
SpecsClass = SqlDr["Specs"].ToString();
TCDetailClass = SqlDr["TermsCondition"].ToString();
CurrencyNameTmpClass = SqlDr["Currency"].ToString();
ExchangeRateTmpClass = Convert.ToDouble(SqlDr["ExchangeRate"].ToString());
BasePriceClass = Convert.ToDouble(SqlDr["BasePrice"].ToString());
UnitPriceClass = Convert.ToDouble(SqlDr["UnitRate"].ToString());
QtyClass = Convert.ToDouble(SqlDr["Qty"].ToString());
LessDiscountClass = Convert.ToDouble(SqlDr["DiscountAmount"].ToString());
AddOtherChargesClass = Convert.ToDouble(SqlDr["AddOtherAmount"].ToString());
Tax1PerClass = Convert.ToDouble(SqlDr["Tax1Per"].ToString());
Tax2PerClass = Convert.ToDouble(SqlDr["Tax2Per"].ToString());
Tax3PerClass = Convert.ToDouble(SqlDr["Tax3Per"].ToString());
Tax4PerClass = Convert.ToDouble(SqlDr["Tax4Per"].ToString());
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = false;
}
}
}
// End Try
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return TransactionStatusClass;
}
public Boolean GetOrderSalesDetailFromClass(string OrderDetail)
{
try
{
GetConnectionForClass(); // Function Call
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("OrderSalesDetail", SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("OrderDetail", OrderDetail);
SqlDr = SqlCm.ExecuteReader();
TransactionStatusClass = false;
if (SqlDr.HasRows)
{
if (SqlDr.Read())
{
OrderDetailClass = SqlDr["OrderDetail"].ToString();
OrderDateClass = DateTime.Parse(SqlDr["OrderDate"].ToString());
OrderStatusClass = SqlDr["OrderStatus"].ToString();
RemarkClass = SqlDr["ApproveRemark"].ToString();
PiDetailClass = SqlDr["PiDetail"].ToString();
BrandCodeClass = int.Parse(SqlDr["BrandCode"].ToString());
BrandNameClass = SqlDr["BrandName"].ToString();
ModelCodeClass = int.Parse(SqlDr["ModelCode"].ToString());
ModelNameClass = SqlDr["ModelName"].ToString();
TransmissionClass = SqlDr["Transmission"].ToString();
CustomerCodeClass = int.Parse(SqlDr["CustomerCode"].ToString());
CustomerNameClass = SqlDr["CustomerName"].ToString();
AddressCodeClass = int.Parse(SqlDr["AddressCode"].ToString());
ContactPersonNameShipClass = SqlDr["ContactPersonName"].ToString();
ContactPersonDesignationShipClass = SqlDr["ContactPersonDesignation"].ToString();
ContactPersonPhoneNoClass = SqlDr["ContactPersonPhoneNo"].ToString();
CustomerEmailIdClass = SqlDr["CustomerEmailId"].ToString();
CustomerAddress1Class = SqlDr["CustomerAddress1"].ToString();
CustomerAddress2Class = SqlDr["CustomerAddress2"].ToString();
RequestedByNameClass = SqlDr["StaffName"].ToString();
RequestedByEmailClass = SqlDr["StaffEmailID"].ToString();
DealTypeClass = SqlDr["DealType"].ToString();
RegistrationClass = SqlDr["Registration"].ToString();
TaxOptionClass = SqlDr["TaxOption"].ToString();
CustomerTaxCategoryClass = SqlDr["TaxCategory"].ToString();
PaymentTermsClass = SqlDr["PaymentTerms"].ToString();
TaxApplyClass = SqlDr["TaxApply"].ToString();
//SpecsClass = SqlDr["Specs"].ToString();
//TCDetailClass = SqlDr["TermsCondition"].ToString();
CurrencyNameTmpClass = SqlDr["Currency"].ToString();
ExchangeRateTmpClass = Convert.ToDouble(SqlDr["ExchangeRate"].ToString());
BasePriceClass = Convert.ToDouble(SqlDr["BasePrice"].ToString());
UnitPriceClass = Convert.ToDouble(SqlDr["UnitRate"].ToString());
QtyClass = Convert.ToDouble(SqlDr["Qty"].ToString());
LessDiscountClass = Convert.ToDouble(SqlDr["DiscountAmount"].ToString());
AddOtherChargesClass = Convert.ToDouble(SqlDr["AddOtherAmount"].ToString());
Tax1PerClass = Convert.ToDouble(SqlDr["Tax1Per"].ToString());
Tax2PerClass = Convert.ToDouble(SqlDr["Tax2Per"].ToString());
Tax3PerClass = Convert.ToDouble(SqlDr["Tax3Per"].ToString());
Tax4PerClass = Convert.ToDouble(SqlDr["Tax4Per"].ToString());
Tax1AmountClass = Convert.ToDouble(SqlDr["Tax1Amount"].ToString());
Tax2AmountClass = Convert.ToDouble(SqlDr["Tax2Amount"].ToString());
Tax3AmountClass = Convert.ToDouble(SqlDr["Tax3Amount"].ToString());
Tax4AmountClass = Convert.ToDouble(SqlDr["Tax4Amount"].ToString());
Tax1NameClass = SqlDr["Tax1Name"].ToString();
Tax2NameClass = SqlDr["Tax2Name"].ToString();
Tax3NameClass = SqlDr["Tax3Name"].ToString();
Tax4NameClass = SqlDr["Tax4Name"].ToString();
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = false;
}
}
}
// End Try
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return TransactionStatusClass;
}
//
public Boolean GetModelDetailFromClass(int ModelCode)
{
try
{
GetConnectionForClass(); // Function Call
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("ModelDetail", SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("ModelCode", ModelCode);
// SqlCm = new SqlCommand(SqlQryClass, SqlCn);
//SqlCm.CommandType = CommandType.Text;
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.HasRows)
{
if (SqlDr.Read())
{
ModelNameClass = SqlDr["ModelName"].ToString();
TransmissionClass = SqlDr["Transmission"].ToString();
ModelGroupNameClass = SqlDr["ModelGroupName"].ToString();
BrandNameClass = SqlDr["BrandName"].ToString();
ModelGroupCodeClass = int.Parse(SqlDr["ModelGroupCode"].ToString());
BrandCodeClass = int.Parse(SqlDr["BrandCode"].ToString());
//EngineCapacityClass = Convert.ToDouble( SqlDr["EngineCapacity"].ToString());
SpecsClass = SqlDr["Specs"].ToString();
ModelRetailPriceClass = Convert.ToDouble(SqlDr["RetailPrice"].ToString());
ModelSalesPriceClass = Convert.ToDouble(SqlDr["SalesPrice"].ToString());
ModelManagementPriceClass = Convert.ToDouble(SqlDr["ManagementPrice"].ToString());
ModelCurrencyClass = SqlDr["ModelCurrency"].ToString();
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = false;
}
}
}
// End Try
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return TransactionStatusClass;
}
// End Model detail
public Boolean GetVehcileDetailFromClass(string SearchMode, string SearchValue)
{
try
{
GetConnectionForClass(); // Function Call
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("VehicleDetail", SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("SearchMode", SearchMode);
SqlCm.Parameters.AddWithValue("SearchValue", SearchValue);
// SqlCm = new SqlCommand(SqlQryClass, SqlCn);
//SqlCm.CommandType = CommandType.Text;
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.HasRows)
{
if (SqlDr.Read())
{
RegNoClass = SqlDr["RegNo"].ToString();
CustomerCodeClass = int.Parse(SqlDr["CustomerCode"].ToString());
CustomerNameClass = SqlDr["CustomerName"].ToString();
ModelGroupNameClass = SqlDr["ModelGroupName"].ToString();
ModelGroupCodeClass = int.Parse(SqlDr["ModelGroupCode"].ToString());
BrandNameClass = SqlDr["BrandName"].ToString();
BrandCodeClass = int.Parse(SqlDr["BrandCode"].ToString());
BrandNickNameClass = SqlDr["BrandNameNick"].ToString();
ModelNameClass = SqlDr["ModelName"].ToString();
ModelCodeClass = int.Parse(SqlDr["ModelCode"].ToString());
TransmissionClass = SqlDr["Transmission"].ToString();
ChassisNoClass = SqlDr["Chassis"].ToString();
ModelYearClass = int.Parse(SqlDr["ModelYear"].ToString());
EngineNoClass = SqlDr["Engine"].ToString();
SaleTypeClass = SqlDr["SaleType"].ToString();
SoldDateClass = SqlDr["SoldDate"].ToString();
DeliveryNoteNoClass = SqlDr["deliverydetails"].ToString();
LoyaltyCardNoClass = SqlDr["LoyaltyCardNo"].ToString();
//EngineCapacityClass = Convert.ToDouble( SqlDr["EngineCapacity"].ToString());
SpecsClass = SqlDr["Specs"].ToString();
ModelRetailPriceClass = Convert.ToDouble(SqlDr["RetailPrice"].ToString());
ModelSalesPriceClass = Convert.ToDouble(SqlDr["SalesPrice"].ToString());
ModelManagementPriceClass = Convert.ToDouble(SqlDr["ManagementPrice"].ToString());
ModelCurrencyClass = SqlDr["ModelCurrency"].ToString();
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = false;
}
}
}
// End Try
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return TransactionStatusClass;
}
// End Vehcile detail
public Boolean GetProformaSalesTCBankDetailFromClass(int BrandCode)
{
try
{
GetConnectionForClass(); // Function Call
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("ProformaSalesTCBankDetail", SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("BrandCode", BrandCode);
// SqlCm = new SqlCommand(SqlQryClass, SqlCn);
//SqlCm.CommandType = CommandType.Text;
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.HasRows)
{
if (SqlDr.Read())
{
TCDetailClass = SqlDr["TcDetails"].ToString();
BankNameClass = SqlDr["BankName"].ToString();
AccountNoClass = SqlDr["AccountNo"].ToString();
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = false;
}
}
}
// End Try
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
}
// End Finally
return TransactionStatusClass;
}
// End TC and Bank detail
public Boolean GetSupplierDetailByCodeFromClass(int SupplierCode)
{
try
{
GetConnectionForClass();
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("SupplierDetail", SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("SupplierCode", SupplierCode);
//SqlCm.Parameters.AddWithValue("SupplierName", SupplierName);
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.Read())
{
SupplierNameClass = SqlDr["SupplierName"].ToString();
SupplierCodeClass = int.Parse(SqlDr["SupplierCode"].ToString());
SupplierContactPersonNameClass = SqlDr["SupplierContactPersonName"].ToString();
SupplierContactPersonPhoneNoClass = SqlDr["SupplierContactPersonPhoneNo"].ToString();
SupplierAddress1Class = SqlDr["SupplierAddress1"].ToString();
SupplierAddress2Class = SqlDr["SupplierAddress2"].ToString();
SupplierTypeClass = SqlDr["SupplierType"].ToString();
SupplierTinNoClass = SqlDr["SupplierTinNo"].ToString();
SupplierVatNoClass = SqlDr["SupplierVatNo"].ToString();
SupplierTaxIdClass = SqlDr["SupplierTaxId"].ToString();
SupplierPhoneNoClass = SqlDr["SupplierPhoneNo"].ToString();
SupplierMobileNoClass = SqlDr["SupplierMobileNo"].ToString();
SupplierEmailIdClass = SqlDr["SupplierEmailId"].ToString();
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = true;
}
}
// End Try
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
}
// End Finally
return TransactionStatusClass;
}
// End Supplier Detail
public Boolean ActionTakenFromClass(string FormName, int ModuleNo, int FormNo, int SpecialPermissionNo, string ActionTaken, string Date, string Time, int MainCompanyCode, int MainBranchCode, string ComputerName, string IPAddressUser, string MacAddressUser, string WinUser, string UserName, string ActionDetails)
{
GetConnectionForClass();
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlQryClass = "Insert Into (FormName,ModuleNo,FormNo,SpecialPermissionNo, ActionTaken, " +
"Date,Time,MainCompanyCode,MainBranchCode,ComputerName,IPAddress, " +
"MacAddress,WinUser,UserName,ActionDetails)" +
"Values ( " +
"@FormName,@ModuleNo,@FormNo,@SpecialPermissionNo, @ActionTaken, " +
"@Date,@Time,@MainCompanyCode,@MainBranchCode,@ComputerName,@IPAddressUser, " +
"@MacAddressUser,@WinUser,@UserName,@ActionDetails " +
" " +
" )";
try
{
SqlCommand SqlCm = new SqlCommand(SqlQryClass, SqlCn);
SqlCm.CommandType = CommandType.Text;
SqlCm.Parameters.AddWithValue("@FromName", FormName);
SqlCm.Parameters.AddWithValue("@ModuleNo", ModuleNo);
SqlCm.Parameters.AddWithValue("@FormNo", ModuleNo);
SqlCm.Parameters.AddWithValue("@SpecialPermissionNo", SpecialPermissionNo);
SqlCm.Parameters.AddWithValue("@ActionTaken", ActionTaken);
SqlCm.Parameters.AddWithValue("@Date", Date);
SqlCm.Parameters.AddWithValue("@Time", Time);
SqlCm.Parameters.AddWithValue("@MainCompanyCode", MainCompanyCode);
SqlCm.Parameters.AddWithValue("@MainBranchCode", MainBranchCode);
SqlCm.Parameters.AddWithValue("@ComputerName", ComputerName);
SqlCm.Parameters.AddWithValue("@IPAddressUser", IPAddressUser);
SqlCm.Parameters.AddWithValue("@MacAddressUser", MacAddressUser);
SqlCm.Parameters.AddWithValue("@WinUser", WinUser);
SqlCm.Parameters.AddWithValue("@UserName", UserName);
SqlCm.Parameters.AddWithValue("@ActionDetails", ActionDetails);
SqlCm.Connection = SqlCn;
SqlCm.ExecuteNonQuery();
TransactionStatusClass = true;
}
// End Try
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
}
// End Finally
return TransactionStatusClass;
}
// End Action Taken
public Boolean GetExchangeRateFromClass(string ForeignCurrencyName)
{
try
{
GetConnectionForClass();
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("select top(1) ExchangeRate,LocalCurrency,ForeignCurrency,ExchangeRateType from ExchangeRate where ActiveStatus='Y' and ForeignCurrency= '" + ForeignCurrencyName + "' order by r_id desc", SqlCn);
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.Read())
{
CurrencyExchangeRateClass = Convert.ToDouble(SqlDr["ExchangeRate"].ToString());
}
else
{
CurrencyExchangeRateClass = 0;
}
TransactionStatusClass = true;
}
// End Try
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return TransactionStatusClass;
}
// Get exchange rate
public Boolean GetInvoiceDetailFromClass(string InvoiceNo, int MainBranchCode)
{
try
{
GetConnectionForClass();
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("InvoiceDetail", SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("InvoiceDetail", InvoiceNo);
SqlCm.Parameters.AddWithValue("MainBranchCode", MainBranchCode);
//SqlCm.Parameters.AddWithValue("SupplierName", SupplierName)=
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.Read())
{
InvoiceNoDetailClass = SqlDr["InvoiceDetail"].ToString();
InvoiceDateClass = SqlDr["InvoiceDate"].ToString();
InvoiceStatusClass = SqlDr["InvoiceStatus"].ToString();
PartsAmountClass = Convert.ToDouble(SqlDr["PartsAmount"].ToString());
LabourAmountClass = Convert.ToDouble(SqlDr["LabourAmount"].ToString());
TotalAmountClass = Convert.ToDouble(SqlDr["TotalAmount"].ToString());
DiscountAmountPartsClass = Convert.ToDouble(SqlDr["DiscountAmountParts"].ToString());
DiscountAmountLabourClass = Convert.ToDouble(SqlDr["DiscountAmountLabour"].ToString());
DiscountAmountClass = Convert.ToDouble(SqlDr["DiscountAmount"].ToString());
Tax1AmountPartsClass = Convert.ToDouble(SqlDr["Tax1AmountParts"].ToString());
Tax2AmountPartsClass = Convert.ToDouble(SqlDr["Tax2AmountParts"].ToString());
Tax3AmountPartsClass = Convert.ToDouble(SqlDr["Tax3AmountParts"].ToString());
Tax1AmountServiceClass = Convert.ToDouble(SqlDr["Tax1AmountService"].ToString());
Tax2AmountServiceClass = Convert.ToDouble(SqlDr["Tax2AmountService"].ToString());
Tax3AmountServiceClass = Convert.ToDouble(SqlDr["Tax3AmountService"].ToString());
TaxAmountClass = Convert.ToDouble(SqlDr["TaxAmount"].ToString());
NetAmountClass = Convert.ToDouble(SqlDr["NetAmount"].ToString());
InvoiceCancelStatusClass = SqlDr["InvoiceCancelStatus"].ToString();
InvoiceTypeNameClass = SqlDr["InvoiceType"].ToString();
InvoiceTypeCodeClass = SqlDr["InvoiceTypeCode"].ToString();
InvoiceCancelDateClass = SqlDr["InvoiceCancelDate"].ToString();
InvoiceCancelRemarkClass = SqlDr["InvoiceCancelRemark"].ToString();
InvoiceRemarkClass = SqlDr["InvoiceRemark"].ToString();
PaymentModeClass = SqlDr["PaymentMode"].ToString();
PaidAmountClass = Convert.ToDouble(SqlDr["PaidAmount"].ToString());
BalanceAmountClass = Convert.ToDouble(SqlDr["BalanceAmount"].ToString());
CustomerCodeClass = int.Parse(SqlDr["CustomerCode"].ToString());
ModelCodeClass = int.Parse(SqlDr["ModelCode"].ToString());
RegNoClass = SqlDr["RegNo"].ToString();
JobNoDetailClass = SqlDr["JobNoDetail"].ToString();
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = true;
}
}
// End Try
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
}
// End Finally
return TransactionStatusClass;
}
// End Invoice Detail
public Boolean GetCustomerBalanceClass(int customercode, int maincompanycode)
{
try
{
GetConnectionForClass();
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("CustomerBalance", SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("CustomerCode", customercode);
SqlCm.Parameters.AddWithValue("MainCompanyCode", maincompanycode);
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.HasRows)
{
if (SqlDr.Read())
{
CustomerBalanceClass = Convert.ToDouble(SqlDr["CustomerBalance"].ToString());
if (CustomerBalanceClass < 0)
{
BalanceTypeClass = "Credit : "; // Debit-Credit
}
else
{
BalanceTypeClass = "Debit : "; // Debit-Credit
}
TransactionStatusClass = true;
}
}
else
{
CustomerBalanceClass = 0;
BalanceTypeClass = "";
TransactionStatusClass = false;
}
}
// End Try
catch (Exception ex)
{
}
// Catch
finally
{
SqlCn.Close();
//SqlCm.Dispose();
//SqlDr.Dispose();
}
// End Finally
return TransactionStatusClass;
}
// End Get Customer Balance
public Boolean GetInvoiceDetailSupplierFromClass(string RowId)
{
try
{
GetConnectionForClass();
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("InvoiceDetailSupplier", SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("RowId", RowId);
//SqlCm.Parameters.AddWithValue("SupplierName", SupplierName)=
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.Read())
{
InvoiceDateClass = SqlDr["Date"].ToString();
InvoiceNoDetailClass = SqlDr["InvoiceDetail"].ToString();
InvoiceAmountClass = Convert.ToDouble(SqlDr["InvoiceAmount"].ToString());
BalanceAmountClass = Convert.ToDouble(SqlDr["Balance"].ToString());
PaidAmountClass = Convert.ToDouble(SqlDr["PaidAmount"].ToString());
CreditNoteAmountClass = Convert.ToDouble(SqlDr["CreditNoteAmount"].ToString());
DebitNoteAmountClass = Convert.ToDouble(SqlDr["DebitNoteAmount"].ToString());
TransactionDetailsClass = SqlDr["TransactionDetails"].ToString();
DocumentDetailClass = SqlDr["DocumentDetail"].ToString();
CurrencyNameClass = SqlDr["CurrencyName"].ToString();
ExchangeRateClass = Convert.ToDouble(SqlDr["ExchangeRate"]);
TransactionTypeClass = SqlDr["TransactionType"].ToString();
TransactionIdClass = SqlDr["TransactionId"].ToString();
BrandCodeClass = int.Parse(SqlDr["BrandCode"].ToString());
TransactionStatusClass = true;
}
else
{
TransactionStatusClass = true;
}
}
// End Try
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
}
// End Finally
return TransactionStatusClass;
}
// End Supplier Invoice Detail
public Boolean GetCOALedgerCode(string COALedgerType)
{
try
{
GetConnectionForClass();
SqlCn = new SqlConnection(ConString);
SqlCn.Open();
SqlCm = new SqlCommand("FindCOALedgerCode", SqlCn); // PermissionForm
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("COALedgerType", COALedgerType);
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.HasRows)
{
if (SqlDr.Read())
{
COALedgerHead1Class = int.Parse(SqlDr["AccountHead1Code"].ToString());
COALedgerHead2Class = int.Parse(SqlDr["AccountHead2Code"].ToString());
COALedgerCodeClass = SqlDr["LedgerCode"].ToString();
COALedgerNameClass = SqlDr["LedgerName"].ToString();
TransactionStatusClass = true;
}
}
else
{
TransactionStatusClass = false;
}
}
catch (Exception ex)
{
TransactionStatusClass = false;
}
// Catch
finally
{
SqlCn.Close();
}
// End Finally
return TransactionStatusClass;
}
// End COA Ledger
//===============================================================================
// Start Convert Value To Word
public string ConvertToWordFromClass(double GrandTotalForWord)
{
string currencymain = "Naira "; // Added by vithal wadje
string currencysub = " Kobo "; // Added by vithal wadje
if (GrandTotalForWord == 0)
{
ValueInWordClass = "No Value Found";
}
if (GrandTotalForWord < 0)
{
ValueInWordClass = "Invalid Amount";
}
// TxtNetPayable.Text = GrandTotalForWord.ToString("###0.00");
string NetValue = GrandTotalForWord.ToString("###0.00");
ValueInWordClass = "Amount In Word : ";
//string[] no = TxtNetPayable.Text.Split('.');
string[] no = NetValue.Split('.');
//string[] no = NetValue.Split('.');
if ((no[0] != null) && (no[1] != "00"))
{
Number = no[0]; deciml = no[1];
_number = (NameOfNumber(Number));
_deciml = (NameOfNumber(deciml));
ValueInWordClass = currencymain + _number.Trim() + " and " + _deciml.Trim() + currencysub;
}
if ((no[0] != null) && (no[1] == "00"))
{
Number = no[0];
_number = (NameOfNumber(Number));
ValueInWordClass = currencymain + _number.Trim() + " Only ";
}
if ((Convert.ToDouble(no[0]) == 0) && (no[1] != null))
{
deciml = no[1];
_deciml = (NameOfNumber(deciml));
ValueInWordClass = currencymain + _deciml.Trim() + " Only ";
}
return ValueInWordClass;
}
string FormatNumber<T>(T number, int maxDecimals = 4)
{
return Regex.Replace(String.Format("{0:n" + maxDecimals + "}", number),
@"[" + System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator + "]?0+$", "");
}
public string NameOfNumber(string Number)
{
string GroupName = "";
string OutPut = "";
if ((Number.Length % 3) != 0)
{
Number = Number.PadLeft((Number.Length + (3 - (Number.Length % 3))), '0');
}
string[] Array = new string[Number.Length / 3];
Int16 Element = -1;
Int32 DisplayCount = -1;
bool LimitGroupsShowAll = false;
int LimitGroups = 0;
bool GroupToWords = true;
for (Int16 Count = 0; Count <= Number.Length - 3; Count += 3)
{
Element += 1; Array[Element] = Number.Substring(Count, 3);
}
if (LimitGroups == 0)
{
LimitGroupsShowAll = true;
}
for (Int16 Count = 0; (Count <= ((Number.Length / 3) - 1)); Count++)
{
DisplayCount++; if (((DisplayCount < LimitGroups) || LimitGroupsShowAll))
{
if (Array[Count] == "000") continue;
{
GroupName = US[((Number.Length / 3) - 1) - Count + 1];
}
if ((GroupToWords == true))
{
OutPut += Group(Array[Count]).TrimEnd(' ') + " " + GroupName + " ";
}
else
{
OutPut += Array[Count].TrimStart('0') + " " + GroupName;
}
}
}
Array = null; return OutPut;
}
private string Group(string Argument)
{
string Hyphen = ""; string OutPut = "";
Int16 d1 = Convert.ToInt16(Argument.Substring(0, 1));
Int16 d2 = Convert.ToInt16(Argument.Substring(1, 1));
Int16 d3 = Convert.ToInt16(Argument.Substring(2, 1));
if ((d1 >= 1))
{
OutPut += SNu[d1] + " hundred ";
}
if ((double.Parse(Argument.Substring(1, 2)) < 20))
{
OutPut += SNu[Convert.ToInt16(Argument.Substring(1, 2))];
}
if ((double.Parse(Argument.Substring(1, 2)) >= 20))
{
if (Convert.ToInt16(Argument.Substring(2, 1)) == 0)
{
Hyphen += " ";
}
else
{
Hyphen += " ";
}
OutPut += SNt[d2] + Hyphen + SNu[d3];
}
return OutPut;
}
private void Initialize()
{
SNu[0] = "";
SNu[1] = "One";
SNu[2] = "Two";
SNu[3] = "Three";
SNu[4] = "Four";
SNu[5] = "Five";
SNu[6] = "Six";
SNu[7] = "Seven";
SNu[8] = "Eight";
SNu[9] = "Nine";
SNu[10] = "Ten";
SNu[11] = "Eleven";
SNu[12] = "Twelve";
SNu[13] = "Thirteen";
SNu[14] = "Fourteen";
SNu[15] = "Fifteen";
SNu[16] = "Sixteen";
SNu[17] = "Seventeen";
SNu[18] = "Eighteen";
SNu[19] = "Nineteen";
SNt[2] = "Twenty";
SNt[3] = "Thirty";
SNt[4] = "Forty";
SNt[5] = "Fifty";
SNt[6] = "Sixty";
SNt[7] = "Seventy";
SNt[8] = "Eighty";
SNt[9] = "Ninety";
US[1] = "";
US[2] = "Thousand";
US[3] = "Million";
US[4] = "Billion";
US[5] = "Trillion";
US[6] = "Quadrillion";
US[7] = "Quintillion";
US[8] = "Sextillion";
US[9] = "Septillion";
US[10] = "Octillion";
}
// End Initialize
// End Convert Value To Word
public string ConPathclass { get; set; }
public MainClass()
{
//
// TODO: Add constructor logic here
//
}
}
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" MaintainScrollPositionOnPostback="true" AutoEventWireup="true" CodeFile="ServiceCashCollection.aspx.cs" Inherits="ServiceCashCollection" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
<title>Collection Entry</title>
<%-- <meta http-equiv="Refresh" content="5" />--%>
<%-- =================================== New ============================================= --%>
<link href="../Styles/DefineCss1.css" rel="stylesheet" />
<link href="../Style/GridViewStyleNew.css" rel="stylesheet" />
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script src="../Scripts/jquery-1.7.2.min.js"></script>
<link type="text/css" href="../Scripts/jquery-ui-1.8.19.custom.css" rel="stylesheet" />
<script type="text/javascript" src="../Scripts/jquery-ui-1.8.19.custom.min.js"></script>
<%-- Start Sweet Alert --%>
<script type="text/javascript" src='https://cdn.jsdelivr.net/sweetalert2/6.3.8/sweetalert2.min.js'> </script>
<link rel="stylesheet" href='https://cdn.jsdelivr.net/sweetalert2/6.3.8/sweetalert2.min.css' media="screen" />
<link rel="stylesheet" href='https://cdn.jsdelivr.net/sweetalert2/6.3.8/sweetalert2.css' media="screen" />
<%-- Start Sweet Alert confirm --%>
<script type="text/javascript">
var object = { status: false, ele: null };
function ConfirmMessageOne(event) {
if (object.status) { return true; };
swal({
title: "Are You Sure ?",
text: "You won't be able to revert this! ⚠️",
type: "warning",
showCancelButton: true,
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes, Process",
cancelButtonColor: 'Crimson',
confirmButtonColor: 'LightSeaGreen',
closeOnConfirm: true
}).then(function () {
object.status = true;
object.ele = event;
showLoader2();
$('[id*=BtnSave').click();
});
return false;
};
</script>
<%-- End Sweet Alert confirm --%>
<%-- Start GridView Scroll --%>
<script src="../GridViewScrollBothSide/jquery-1.9.1.min.js"></script>
<script src="../GridViewScrollBothSide/JavaScript.js"></script>
<script src="../GridViewScrollBothSide/GridViewScrollBothSide.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('.MyDataGridViewListOne').gridviewScroll({
width: 1090,
freezesize: 6, // Freeze Number of Columns.
height: 250,
headerrowcount: 1, //Freeze Number of Rows with Header.
arrowsize: 30,
varrowtopimg: "../GridViewScrollBothSide/ImageScroll/arrowvt.png",
varrowbottomimg: "../GridViewScrollBothSide/ImageScroll/arrowvb.png",
harrowleftimg: "../GridViewScrollBothSide/ImageScroll/arrowhl.png",
harrowrightimg: "../GridViewScrollBothSide/ImageScroll/arrowhr.png"
});
});
</script>
<script type="text/javascript">
$(document).ready(function () {
$('.MyDataGridViewListTwo').gridviewScroll({
width: 1090,
freezesize: 2, // Freeze Number of Columns.
height: 250,
headerrowcount: 1, //Freeze Number of Rows with Header.
arrowsize: 30,
varrowtopimg: "../GridViewScrollBothSide/ImageScroll/arrowvt.png",
varrowbottomimg: "../GridViewScrollBothSide/ImageScroll/arrowvb.png",
harrowleftimg: "../GridViewScrollBothSide/ImageScroll/arrowhl.png",
harrowrightimg: "../GridViewScrollBothSide/ImageScroll/arrowhr.png"
});
});
</script>
<script type="text/javascript">
$(document).ready(function () {
$('.MyDataGridViewListThree').gridviewScroll({
width: 1090,
freezesize: 6, // Freeze Number of Columns.
height: 250,
headerrowcount: 1, //Freeze Number of Rows with Header.
arrowsize: 30,
varrowtopimg: "../GridViewScrollBothSide/ImageScroll/arrowvt.png",
varrowbottomimg: "../GridViewScrollBothSide/ImageScroll/arrowvb.png",
harrowleftimg: "../GridViewScrollBothSide/ImageScroll/arrowhl.png",
harrowrightimg: "../GridViewScrollBothSide/ImageScroll/arrowhr.png"
});
});
</script>
<script type="text/javascript">
$(document).ready(function () {
$('.MyDataGridViewListFour').gridviewScroll({
width: 1090,
freezesize: 6, // Freeze Number of Columns.
height: 250,
headerrowcount: 1, //Freeze Number of Rows with Header.
arrowsize: 30,
varrowtopimg: "../GridViewScrollBothSide/ImageScroll/arrowvt.png",
varrowbottomimg: "../GridViewScrollBothSide/ImageScroll/arrowvb.png",
harrowleftimg: "../GridViewScrollBothSide/ImageScroll/arrowhl.png",
harrowrightimg: "../GridViewScrollBothSide/ImageScroll/arrowhr.png"
});
});
</script>
<script type="text/javascript">
$(document).ready(function () {
$('.MyDataGridViewListFive').gridviewScroll({
width: 1090,
freezesize: 6, // Freeze Number of Columns.
height: 250,
headerrowcount: 1, //Freeze Number of Rows with Header.
arrowsize: 30,
varrowtopimg: "../GridViewScrollBothSide/ImageScroll/arrowvt.png",
varrowbottomimg: "../GridViewScrollBothSide/ImageScroll/arrowvb.png",
harrowleftimg: "../GridViewScrollBothSide/ImageScroll/arrowhl.png",
harrowrightimg: "../GridViewScrollBothSide/ImageScroll/arrowhr.png"
});
});
</script>
<%-- End GridView Scroll --%>
<%-- Start Date Picker --%>
<script type="text/javascript">
$(function () {
var date = new Date();
debugger;
$("[id*=TxtInstrumentDate]").datepicker({
showOn: 'button',
autoclose: true,
buttonImageOnly: true,
buttonImage: '../Calendar/calender.png',
dateFormat: 'mm/dd/yy',
changeMonth: true,
changeYear: true,
readOnly: true,
minDate: "-16W",
maxDate: "+16W"
//minDate: new Date()
//yearRange: "-0:+0"
//buttonImage: 'images/calendar.png',
//yearRange: "-1:+0" // last one years
//yearRange: "-1:10" // last one years and next Ten Year
//yearRange: new Date().getFullYear().toString() + ':' + new Date().getFullYear().toString() // Only Current Year
//yearRange:'2021:' + new Date().getFullYear().toString()
});
});
</script>
<%--<script type="text/javascript">
$(function () {
var date = new Date();
debugger;
$("[id*=TxtTravelDate]").datepicker({
showOn: 'button',
autoclose: true,
buttonImageOnly: true,
buttonImage: '../Calendar/calender.png',
dateFormat: 'mm/dd/yy',
changeMonth: true,
changeYear: true,
readOnly: true,
minDate: "-15W"
//minDate: new Date()
//yearRange: "-0:+0"
//buttonImage: 'images/calendar.png',
//yearRange: "-1:+0" // last one years
//yearRange: "-1:10" // last one years and next Ten Year
//yearRange: new Date().getFullYear().toString() + ':' + new Date().getFullYear().toString() // Only Current Year
//yearRange:'2021:' + new Date().getFullYear().toString()
});
});
</script>--%>
<%--<script type="text/javascript">
$(function () {
var date = new Date();
debugger;
$("[id*=TxtReturnDate]").datepicker({
showOn: 'button',
autoclose: true,
buttonImageOnly: true,
buttonImage: '../Calendar/calender.png',
dateFormat: 'mm/dd/yy',
changeMonth: true,
changeYear: true,
readOnly: true,
//minDate: new Date()
//yearRange: "-0:+0"
//buttonImage: 'images/calendar.png',
//yearRange: "-1:+0" // last one years
//yearRange: "-1:10" // last one years and next Ten Year
//yearRange: new Date().getFullYear().toString() + ':' + new Date().getFullYear().toString() // Only Current Year
//yearRange:'2021:' + new Date().getFullYear().toString()
});
});
</script>--%>
<%--<script type="text/javascript">
$(function () {
var date = new Date();
debugger;
$("[id*=TxtInvoiceDate]").datepicker({
showOn: 'button',
autoclose: true,
buttonImageOnly: true,
buttonImage: '../Calendar/calender.png',
dateFormat: 'mm/dd/yy',
changeMonth: true,
changeYear: true,
readOnly: true,
yearRange: "-1:+0" // last one years
//minDate: new Date()
//yearRange: "-0:+0"
//buttonImage: 'images/calendar.png',
//yearRange: "-1:+0" // last one years
//yearRange: "-1:10" // last one years and next Ten Year
//yearRange: new Date().getFullYear().toString() + ':' + new Date().getFullYear().toString() // Only Current Year
//yearRange:'2021:' + new Date().getFullYear().toString()
});
});
</script>--%>
<%--<script type="text/javascript">
$(function () {
var date = new Date();
debugger;
$("[id*=TxtTravelDateTo]").datepicker({
showOn: 'button',
buttonImageOnly: true,
buttonImage: '../images/calendar.png',
dateFormat: 'mm/dd/yy',
changeMonth: true,
changeYear: true,
readOnly: true,
minDate: new Date(),
maxDate: "+16W"
//yearRange: "-1:+1"
//buttonImage: 'images/calendar.png',
//yearRange: "-1:+0" // last one years
//yearRange: "-1:10" // last one years and next Ten Year
//yearRange: new Date().getFullYear().toString() + ':' + new Date().getFullYear().toString() // Only Current Year
//yearRange:'2021:' + new Date().getFullYear().toString()
});
});
</script>--%>
<%-- <script type="text/javascript">
$(function () {
debugger;
$("[id*=TxtVoucherDate]").datepicker({
showOn: 'button',
buttonImageOnly: true,
buttonImage: '../images/calendar.png',
dateFormat: 'mm/dd/yy',
changeMonth: true,
changeYear: true,
readOnly: true,
yearRange: "-1:+0"
//buttonImage: 'images/calendar.png',
//yearRange: "-1:+0" // last one years
//yearRange: "-1:10" // last one years and next Ten Year
//yearRange: new Date().getFullYear().toString() + ':' + new Date().getFullYear().toString() // Only Current Year
//yearRange:'2021:' + new Date().getFullYear().toString()
});
});
</script>--%>
<%-- <script type="text/javascript">
$(function () {
debugger;
$("[id*=TxtInvoiceDate]").datepicker({
showOn: 'button',
buttonImageOnly: true,
buttonImage: '../images/calendar.png',
dateFormat: 'mm/dd/yy',
changeMonth: true,
changeYear: true,
readOnly: true,
minDate: "-10W"
//yearRange: "-1:+0"
//buttonImage: 'images/calendar.png',
//yearRange: "-1:+0" // last one years
//yearRange: "-1:10" // last one years and next Ten Year
//yearRange: new Date().getFullYear().toString() + ':' + new Date().getFullYear().toString() // Only Current Year
//yearRange:'2021:' + new Date().getFullYear().toString()
});
});
</script>--%>
<%-- End Date Picker --%>
<%-- Start Preview Pdf Image Working --%>
<script type="text/javascript">
function PreviewPdfFile1() {
pdffile = document.getElementById("UploadPdfFile1").files[0];
pdffile_url = URL.createObjectURL(pdffile);
$('#ViewerFile1').attr('src', pdffile_url);
}
</script>
<%-- End Preview Pdf Image Working --%>
<%-- start input file validation --%>
<script>
function fileValidation() {
var fileInput =
document.getElementById('UploadPdfFile1');
var filePath = fileInput.value;
// Allowing file type
var allowedExtensions =
/(\.PDF|\.pdf)$/i;
///(\.jpg|\.jpeg|\.png|\.gif)$/i;
if (!allowedExtensions.exec(filePath)) {
alert('Invalid file type');
fileInput.value = '';
return false;
}
else {
//// Image preview
//if (fileInput.files && fileInput.files[0]) {
// var reader = new FileReader();
// reader.onload = function (e) {
// document.getElementById(
// 'imagePreview').innerHTML =
// '<img src="' + e.target.result
// + '"/>';
// };
// reader.readAsDataURL(fileInput.files[0]);
}
}
</script>
<%-- End Input file validation --%>
<%-- Start Separate Loader Start --%>
<script type="text/javascript">
function showLoader1() {
document.getElementById("loader1").style.display = 'block';
}
function showLoader2() {
document.getElementById("loader2").style.display = 'block';
}
function showLoader3() {
document.getElementById("loader3").style.display = 'block';
}
function showLoader4() {
document.getElementById("loader4").style.display = 'block';
}
</script>
<%-- End Loader End --%>
<%-- Start Disable Right Click --%>
<script>
document.addEventListener("contextmenu", function (event) {
event.preventDefault();
alert('Right Click is Disabled');
}, false);
</script>
<%-- End Disable Right Click --%>
<%-- Start Disable back button in browser --%>
<script type="text/javascript">
function DisableBackButton() {
window.history.forward()
}
DisableBackButton();
window.onload = DisableBackButton;
window.onpageshow = function (evt) { if (evt.persisted) DisableBackButton() }
window.onunload = function () { void (0) }
</script>
<%-- End Disable back button in browser --%>
<%-- Start Disable button After click --%>
<script type="text/javascript">
function DisableClick(elem) {
elem.disabled = true;
}
</script>
<%-- End Disable button After click --%>
<%-- Start Style --%>
<style type="text/css">
table { border: 1px solid #ccc; border-collapse: collapse; }
table th { background-color: #ccc; color: #333; font-weight: bold; }
table th, table td { padding: 5px; border: 1px solid #ccc; }
.MyDataGridViewListOne { align-items: baseline; margin-left: auto; margin-right: auto; }
.MyDataGridViewListOne td { padding: 5px; }
.MyDataGridViewListOne th { padding: 5px; font-family: Arial; font-size: 12px; background-color: #fb8b03; }
.MyDataGridViewListTwo { align-items: baseline; margin-left: auto; margin-right: auto; }
.MyDataGridViewListTwo td { padding: 5px; }
.MyDataGridViewListTwo th { padding: 5px; font-family: Arial; font-size: 12px; background-color: #f4f909; }
.MyDataGridViewListThree { align-items: baseline; margin-left: auto; margin-right: auto; }
.MyDataGridViewListThree td { padding: 5px; }
.MyDataGridViewListThree th { padding: 5px; font-family: Arial; font-size: 12px; background-color: #fbc406; }
.MyDataGridViewListFour { align-items: baseline; margin-left: auto; margin-right: auto; }
.MyDataGridViewListFour td { padding: 5px; }
.MyDataGridViewListFour th { padding: 5px; font-family: Arial; font-size: 12px; background-color: #94fcc9; }
.MyDataGridViewListFive { align-items: baseline; margin-left: auto; margin-right: auto; }
.MyDataGridViewListFive td { padding: 5px; }
.MyDataGridViewListFive th { padding: 5px; font-family: Arial; font-size: 12px; background-color: #94fcc9; }
.ComboBoxStyle .ajax__combobox_itemlist li { background-color: DarkGreen; border: 1px solid YellowGreen; color: White; font-size: medium; font-family: Arial; font-size: 12px; padding-bottom: 5px; }
.bg_Entry_Color1 { background-color: #f0f5f5; }
.bg_Entry_Color2 { background-color: #e9e4f0; }
.bg_Entry_Color3 { background-color: #e3f5ec; }
.bg_Entry_Color4 { background-color: #E6E6FA; }
.bg_Entry_Color5 { background-color: #fbf8da; }
.bg_Entry_Color6 { background-color: #FFF0F5; }
.bg_Entry_Color7 { background-color: #F5F5F5; }
.bg_Entry_Colour8_UserDetails { background-color: #708090; }
.mydropdownlistnew { color: #fff; font-size: 20px; padding: 5px 10px; border-radius: 5px; background-color: #cc2a41; font-weight: bold; }
.mydropdownlistnew1 { color: #fff; font-size: 20px; padding: 5px 10px; border-radius: 5px 12px; background-color: #292929; font-weight: bold; }
</style>
<%-- End Style --%>
<%-- =================================== New ============================================= --%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<%-- Start Heading --%>
<div class="container mb-0 mt-0">
<div class="row g-0 " style="background-image: linear-gradient(to right, lightblue ,lightgreen);">
<div class="col col-12 fs-3 text-center">
<asp:Label ID="Label1" runat="server" Text="Cash Collection - Service"></asp:Label>
</div>
</div>
</div>
<%-- End Heading --%>
<%-- =========== Start For Session Time Out ======================================== --%>
<%-- <div class="container">
<h3>Session Idle: <span id="secondsIdle"></span> seconds.</h3>
<asp:LinkButton ID="lnkFakeSessionTimeOut" runat="server" />
<ajaxToolkit:ModalPopupExtender ID="mpeSessionTimeout" BehaviorID="mpeSessionTimeout" runat="server" PopupControlID="pnlPopupSessionTimeout" TargetControlID="lnkFakeSessionTimeOut"
OkControlID="btnSessionYes" CancelControlID="btnSessionNo" BackgroundCssClass="modalBackground" OnOkScript="ResetSession()">
</ajaxToolkit:ModalPopupExtender>
<asp:Panel ID="pnlPopupSessionTimeout" CssClass=" bg-info" runat="server">
<div class="modal-header fs-5" >
<asp:Label ID="Label48" runat="server" CssClass="fs-4 text-center" Text="Session Expiring!"></asp:Label>
</div>
<div class="modal-body" >
Your Session will expire in <span id="seconds"></span> seconds.<br />
Do you want to continue session ?
</div>
<div class=" modal-footer" align="right" >
<div class="container-fluid ">
<div class="container mb-1 p-0 ">
<div class="float-lg-start float-none">
<asp:Button ID="btnSessionYes" runat="server" Text="Yes" CssClass=" btn btn-success " />
</div>
<div class="float-lg-end fs-5 " style="color: blue">
<asp:Button ID="btnSessionNo" runat="server" Text="No" CssClass=" btn btn-danger" />
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</asp:Panel>
</div>--%>
<%-- =========== Start For Session Time Out ======================================== --%>
<%-- Start Option --%>
<div class=" container mb-0 mt-0 ">
<asp:Panel ID="PnlOption" runat="server">
<div class="row g-0 text-center bg-primary">
<asp:Label ID="Label22" CssClass=" text-white fs-5 " runat="server" Text="Option Selection"></asp:Label>
</div>
<div class="row g-0">
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label20" runat="server" Text="Cashier Active"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:Label ID="LblCashierActiveStatus" runat="server" Text="" CssClass="text-danger"></asp:Label>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label3" runat="server" Text="Standard Currency"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:Label ID="LblStdCurrencyName" runat="server" Text="" CssClass="text-danger"></asp:Label>
</div>
</div>
<div class="row g-0">
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label26" runat="server" Text="Currency"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:DropDownList ID="DdlCurrency"
CssClass="form-select text-start w-75 mydropdownlist "
AutoPostBack="true" runat="server"
OnSelectedIndexChanged="DdlCurrency_SelectedIndexChanged">
</asp:DropDownList>
</div>
</div>
<div class="row g-0 ">
<div class=" col-3 p-1 text-start border border-1 ">
<asp:Label ID="Label5" runat="server" Text="Exchange Rate"></asp:Label>
</div>
<div class=" col-9 p-1 text-start Fs-14-User border border-1">
<asp:TextBox ID="TxtExchnageRate" CssClass="w-75 text-uppercase " runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="false"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtExchnageRate"
ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
</div>
<div class="row g-0">
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label2" runat="server" Text="Invoice Category"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:DropDownList ID="DdlInvoiceCategory"
CssClass="form-select text-start w-75 MyDropDownList1"
AutoPostBack="true" runat="server" OnSelectedIndexChanged="DdlInvoiceCategory_SelectedIndexChanged">
<asp:ListItem>SELECT</asp:ListItem>
<asp:ListItem>WORKSHOP</asp:ListItem>
<asp:ListItem>COUNTER SALE</asp:ListItem>
</asp:DropDownList>
</div>
</div>
<div class="row g-0">
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label44" runat="server" Text="Payment Category"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:DropDownList ID="DdlPaymentCategory"
OnSelectedIndexChanged="DdlPaymentCategory_SelectedIndexChanged"
CssClass="form-select text-start w-75 MyDropDownList1"
AutoPostBack="true" runat="server">
<asp:ListItem>SELECT</asp:ListItem>
<asp:ListItem>COLLECTION</asp:ListItem>
<asp:ListItem>ADVANCE</asp:ListItem>
</asp:DropDownList>
</div>
</div>
</asp:Panel>
</div>
<%-- End Option --%>
<%-- Start Search Customer --%>
<div class="container mb-0">
<asp:Panel ID="PnlSearchAdvance" runat="server">
<div class="row g-0 " style="background-image: linear-gradient(to right, #e6d2fa ,#e6d2fa);">
<div class="col col-3 text-center fs-5 ">
<asp:RadioButton ID="RbtnCustomerAdvance" CssClass=" btn-outline-primary Rbtn-Hover-user"
GroupName="Advance" runat="server"
Text="Customer" />
</div>
<div class="col col-3 text-center fs-5 ">
<asp:RadioButton ID="RbtnVehicleAdvance" CssClass=" btn-outline-primary Rbtn-Hover-user "
GroupName="Advance" runat="server"
Text="Vehicle No" />
</div>
<div class="col-6 d-flex justify-content-center">
<asp:TextBox ID="TxtSearchValueAdvance" placeholder="Search Value" CssClass="form-control text-uppercase w-100 " runat="server" AutoCompleteType="Disabled"></asp:TextBox>
<div class="h-10 align-items-center justify-content-center">
<div style="background: lightgray">
<img id="loader1" style="display: none;" src="https://www.aspsnippets.com/demos/loader.gif" alt="" />
</div>
</div>
<asp:Button ID="BtnSearchAdvance" CssClass="btn btn-primary btn-outline-dark rounded-pill"
OnClientClick="showLoader1();"
runat="server" Text="Search Value" OnClick="BtnSearchAdvance_Click" />
</div>
</div>
</asp:Panel>
</div>
<%-- End search Advance --%>
<%-- Start Search Collection --%>
<div class="container mb-0">
<asp:Panel ID="PnlSearchCollection" runat="server">
<div class="row g-0 " style="background-image: linear-gradient(to right, #e6d2fa ,#e6d2fa);">
<div class="col col-2 text-center fs-5 ">
<asp:RadioButton ID="RbtnInvoiceCollection" CssClass=" btn-outline-primary Rbtn-Hover-user"
GroupName="Collection" runat="server"
Text="Invoice" />
</div>
<div class="col col-2 text-center fs-5 ">
<asp:RadioButton ID="RbtnJobOrderCollection" CssClass=" btn-outline-primary Rbtn-Hover-user "
GroupName="Collection" runat="server"
Text="Job Order" />
</div>
<div class="col col-2 text-center fs-5 ">
<asp:RadioButton ID="RbtnVehicleCollection" CssClass=" btn-outline-primary Rbtn-Hover-user "
GroupName="Collection" runat="server"
Text="Vehicle No" />
</div>
<div class="col-6 d-flex justify-content-center">
<asp:TextBox ID="TxtSearchValueCollection" placeholder="Search Value" CssClass="form-control text-uppercase w-100 " runat="server" AutoCompleteType="Disabled"></asp:TextBox>
<div class="h-10 align-items-center justify-content-center">
<div style="background: lightgray">
<img id="loader2" style="display: none;" src="https://www.aspsnippets.com/demos/loader.gif" alt="" />
</div>
</div>
<asp:Button ID="BtnSearchCollection" CssClass="btn btn-primary btn-outline-dark rounded-pill"
OnClientClick="showLoader2();"
runat="server" Text="Search Value" OnClick="BtnSearchCollection_Click" />
</div>
</div>
</asp:Panel>
</div>
<%-- End Search Collection --%>
<%-- Start Customer List For advance search --%>
<div class="container mb-0 mt-0" style="font-size: 12px; font-family: Arial;">
<asp:Panel ID="PnlCustomerList" runat="server">
<div class="row g-0 pt-0 " style="">
<div class="col col-12 justify-content-center">
<asp:GridView ID="GvCustomerList" runat="server"
GridLines="Both"
EmptyDataText="No Record Found"
EmptyDataRowStyle-ForeColor="Red"
EmptyDataRowStyle-Font-Bold="true"
EmptyDataRowStyle-BorderStyle="None"
CssClass=" MyDataGridViewListFive"
HorizontalAlign="Center"
RowStyle-CssClass="rows"
AutoGenerateColumns="false">
<EmptyDataRowStyle BorderStyle="None" Font-Bold="True" ForeColor="Red"></EmptyDataRowStyle>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle CssClass="rows"></RowStyle>
<Columns>
<asp:TemplateField HeaderText="Sr.No" ItemStyle-Width="30" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblRowNumber" Text='<%# Container.DataItemIndex + 1 %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<%-- <asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Select">
<ItemTemplate>
<asp:LinkButton ID="LnkSelectCustomer" runat="server" Text="Select" OnClick="ViewInvoiceDetail" ForeColor="Blue" Font-Size="14px" Font-Bold="true"
CommandArgument='<%# Eval("CustomerCode") + ";" + Eval("RegNo") + ";" + Eval("ModelCode") + ";" + Eval("CustomerCode") + ";" + Eval("NetAmount") + ";" + Eval("Paid") + ";" + Eval("Balance") + ";" + Eval("JobNoDetail") + ";" + Eval("InvoiceDate") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Select">
<ItemTemplate>
<asp:LinkButton ID="LnkSelectCustomer" runat="server" Text="Select" OnClick="ViewCustomerDetail" ForeColor="Blue" Font-Size="14px" Font-Bold="true"
CommandArgument='<%# Eval("CustomerCode") + ";" + Eval("BrandCode") + ";" + Eval("ModelCode") + ";" + Eval("BrandName") + ";" + Eval("ModelName") + ";" + Eval("RegNo") + ";" + Eval("Chassis") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="CustomerCode" HeaderText="Code" SortExpression="CustomerCode" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="CustomerName" HeaderText="Customer Name" SortExpression="CustomerName" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="RegNo" HeaderText="Vehicle" SortExpression="RegNo" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="Chassis" HeaderText="Chassis" SortExpression="Chassis" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="MobileNo" HeaderText="Mobile No" SortExpression="MobileNo" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="PhoneNo" HeaderText="Phone No" SortExpression="PhoneNo" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="EmailId" HeaderText="Email Id" SortExpression="EmailId" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="BrandName" HeaderText="BrandName" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="ModelName" HeaderText="ModelName" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="BrandCode" HeaderText="Brand Code" Visible="false" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="ModelCode" HeaderText="Model Code" Visible="false" ItemStyle-Wrap="False"></asp:BoundField>
</Columns>
</asp:GridView>
</div>
</div>
<br />
<br />
</asp:Panel>
</div>
<%-- End Customer List For Advance Search--%>
<%-- Start Invoice List for collection search --%>
<div class="container mb-0 mt-0" style="font-size: 12px; font-family: Arial;">
<asp:Panel ID="PnlInvoiceList" runat="server">
<div class="row g-0 pt-0 " style="">
<div class="col col-12 justify-content-center">
<asp:GridView ID="GVInvoiceList" runat="server"
GridLines="Both"
EmptyDataText="No Record Found"
EmptyDataRowStyle-ForeColor="Red"
EmptyDataRowStyle-Font-Bold="true"
EmptyDataRowStyle-BorderStyle="None"
CssClass=" MyDataGridViewListOne"
HorizontalAlign="Center"
AllowSorting="true"
OnSorting="OnSortingInvoiceList"
RowStyle-CssClass="rows"
AutoGenerateColumns="false" OnRowDataBound="GVInvoiceList_RowDataBound">
<EmptyDataRowStyle BorderStyle="None" Font-Bold="True" ForeColor="Red"></EmptyDataRowStyle>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle CssClass="rows"></RowStyle>
<Columns>
<asp:TemplateField HeaderText="Sr.No" ItemStyle-Width="30" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblRowNumber" Text='<%# Container.DataItemIndex + 1 %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Select">
<ItemTemplate>
<asp:LinkButton ID="LnkSelectInvoice" runat="server" Text="Select" OnClick="ViewInvoiceDetail" ForeColor="Blue" Font-Size="14px" Font-Bold="true"
CommandArgument='<%# Eval("InvoiceDetail") + ";" + Eval("RegNo") + ";" + Eval("ModelCode") + ";" + Eval("CustomerCode") + ";" + Eval("NetAmount") + ";" + Eval("Paid") + ";" + Eval("Balance") + ";" + Eval("JobNoDetail") + ";" + Eval("InvoiceDate") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="InvoiceDate" HeaderText="Invoice Date"
SortExpression="InvoiceDate" ItemStyle-Wrap="False"
DataFormatString="{0:dd-MMM-yyyy}"></asp:BoundField>
<asp:BoundField DataField="InvoiceDetail" HeaderText="Invoice No" SortExpression="InvoiceDetail" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="JobNoDetail" HeaderText="Job/Enquiry No" SortExpression="JobNoDetail" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="NetAmount" HeaderText="NetAmount" DataFormatString="{0:N2}" ItemStyle-Wrap="False" ItemStyle-HorizontalAlign="Right"></asp:BoundField>
<asp:BoundField DataField="Paid" HeaderText="Paid" DataFormatString="{0:N2}" ItemStyle-Wrap="False" ItemStyle-HorizontalAlign="Right"></asp:BoundField>
<asp:BoundField DataField="Balance" HeaderText="Balance" DataFormatString="{0:N2}" ItemStyle-Wrap="False" ItemStyle-HorizontalAlign="Right"></asp:BoundField>
<asp:BoundField DataField="RegNo" HeaderText="Vehicle No" SortExpression="RegNo" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="CustomerName" HeaderText="Customer" SortExpression="CustomerName" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="BrandName" HeaderText="Make" SortExpression="BrandName" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="ModelName" HeaderText="Model" SortExpression="ModelName" ItemStyle-Wrap="False"></asp:BoundField>
</Columns>
</asp:GridView>
</div>
</div>
</asp:Panel>
<br />
<br />
</div>
<%-- End Invoice List for collection search --%>
<%-- Start Invoice Detail --%>
<div class=" container mb-0 mt-0">
<asp:Panel ID="PnlInvoiceDetail" runat="server">
<div class="row g-0 text-center bg-primary">
<asp:Label ID="Label4" CssClass=" text-white fs-5 " runat="server" Text="Invoice Detail"></asp:Label>
</div>
<div class="row g-0 bg_Entry_Color1 ">
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label27" runat="server" Text="Job Order /PE No"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtJobNo" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtJobNo" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label6" runat="server" Text="Invoice No"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtInvoiceNo" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtInvoiceNo" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label7" runat="server" Text="Invoice Date"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtInvoiceDate" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtInvoiceDate" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label8" runat="server" Text="Net Amount"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtNetAmount" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtNetAmount" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label9" runat="server" Text="Paid Amount"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtPaidAmount" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtPaidAmount" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1 text-danger">
<asp:Label ID="Label10" runat="server" Text="Balance Amount"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtBalanceAmount" CssClass="w-75 h-auto text-uppercase text-danger" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtBalanceAmount" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
</div>
</asp:Panel>
</div>
<%-- End Invoice Detail --%>
<%-- Start Customer Detail --%>
<div class=" container mb-0 mt-0 ">
<asp:Panel ID="PnlCustomerDetail" runat="server">
<div class="row g-0 text-center bg-primary">
<asp:Label ID="Label11" CssClass=" text-white fs-5 " runat="server" Text="Customer Detail"></asp:Label>
</div>
<div class="row g-0 bg_Entry_Color2">
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label17" runat="server" Text="Customer Code"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtCustomerCode" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtCustomerCode" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label12" runat="server" Text="Customer Name"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtCustomerName" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtCustomerName" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
</div>
</asp:Panel>
</div>
<%-- End Customer Detail --%>
<%-- Start Vehicle Detail --%>
<div class=" container mb-0 mt-0 ">
<asp:Panel ID="PnlVehicleDetail" runat="server">
<div class="row g-0 text-center bg-primary">
<asp:Label ID="Label13" CssClass=" text-white fs-5 " runat="server" Text="Vehicle Detail"></asp:Label>
</div>
<div class="row g-0 bg_Entry_Color3">
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label30" runat="server" Text="Brand Code"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtBrandCode" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator15" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtBrandCode" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label16" runat="server" Text="Brand Name"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtBrandName" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtBrandName" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label14" runat="server" Text="Model Code"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtModelCode" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtModelCode" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label15" runat="server" Text="Model Name"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtModelName" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtModelName" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label28" runat="server" Text="Vehicle No"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtRegNo" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtRegNo" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label29" runat="server" Text="Chassis No"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtChassisNo" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtChassisNo" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
</div>
</asp:Panel>
</div>
<%-- End Vehicle Detail --%>
<%-- Start ReceiptList --%>
<div class="container mb-0 mt-0" style="font-size: 12px; font-family: Arial;">
<asp:Panel ID="PnlReceiptList" runat="server">
<%--<div class="row g-0 " style="background-image: linear-gradient(to right, #e6d2fa ,#e6d2fa);">
<div class="col-12 d-flex justify-content-start">
<div style="background: lightgray">
<img id="loader4" style="display: none;" src="https://www.aspsnippets.com/demos/loader.gif" alt="" />
</div>
<asp:Button ID="BtnPaymentList" runat="server"
CssClass="btn btn-warning rounded-pill btn-lg "
ToolTip="Process Receipt" Text="View Payment List"
OnClientClick="showLoader3();DisableClick; "
OnClick="BtnPaymentList_Click" />
</div>
</div>--%>
<div class="row g-0 text-center bg-primary">
<asp:Label ID="Label37" CssClass=" text-white fs-5 " runat="server" Text="Payment Received List"></asp:Label>
</div>
<div class="row g-0 pt-0 " style="">
<div class="col col-12 justify-content-center">
<asp:GridView ID="GvReceiptList" runat="server"
GridLines="Both"
EmptyDataText="No Record Found"
EmptyDataRowStyle-ForeColor="Red"
EmptyDataRowStyle-Font-Bold="true"
EmptyDataRowStyle-BorderStyle="None"
CssClass=" MyDataGridViewListTwo"
HorizontalAlign="Center"
AllowSorting="true"
OnSorting="OnSortingReceipt"
RowStyle-CssClass="rows"
AutoGenerateColumns="false">
<EmptyDataRowStyle BorderStyle="None" Font-Bold="True" ForeColor="Red"></EmptyDataRowStyle>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle CssClass="rows"></RowStyle>
<Columns>
<asp:TemplateField HeaderText="Sr.No" ItemStyle-Width="30" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblRowNumber" Text='<%# Container.DataItemIndex + 1 %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<%-- <asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Print Receipt">
<ItemTemplate>
<asp:LinkButton ID="LnkSelectReceipt" runat="server" Text="Select" OnClick="ViewReceiptDetail" ForeColor="Blue" Font-Size="14px" Font-Bold="true"
CommandArgument='<%# Eval("ReceiptDetails") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Action">
<ItemTemplate>
<asp:LinkButton ID="LnkSelectReceipt" runat="server" Text="Print Receipt" OnClick="PrintReceipt" ForeColor="Blue" Font-Size="13px" Width="90px" Font-Bold="true"
CommandArgument='<%# Eval("ReceiptDetails") + ";" + Eval("BrandCode") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="RegNo" HeaderText="Reg No" ItemStyle-ForeColor="Red"
SortExpression="RegNo" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="ReceiptDate" HeaderText="Receipt Date"
SortExpression="ReceiptDate" ItemStyle-Wrap="False"
DataFormatString="{0:dd-MMM-yyyy}"></asp:BoundField>
<asp:BoundField DataField="ReceiptDetails" HeaderText="Receipt No"
SortExpression="ReceiptDetails" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="Amount" HeaderText="Amount" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="Mode" HeaderText="Transaction" SortExpression="Mode" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="Allocated" HeaderText="Allocated Invoice Amount" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Wrap="true" ItemStyle-Width="100px"></asp:BoundField>
<asp:BoundField DataField="Balance" HeaderText="Balance" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="ReceiptType" HeaderText="Type" DataFormatString="{0:N2}" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="InvoiceDetail" HeaderText="Invoice No" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="BrandCode" HeaderText="Brand Code" ItemStyle-Wrap="False"></asp:BoundField>
</Columns>
</asp:GridView>
</div>
</div>
</asp:Panel>
<br />
<br />
</div>
<%-- End ReceiptList --%>
<%-- Start pending invoice List --%>
<div class="container mb-0 mt-0" style="font-size: 12px; font-family: Arial;">
<asp:Panel ID="PnlPendingInvoiceList" runat="server">
<div class="row g-0 text-center bg-primary">
<asp:Label ID="Label40" CssClass=" text-white fs-5 " runat="server" Text="Un-Invoiced List"></asp:Label>
</div>
<div class="row g-0 pt-0 " style="">
<div class="col col-12 justify-content-center">
<asp:GridView ID="GvUnInvoicedList" runat="server"
GridLines="Both"
EmptyDataText="No Record Found"
EmptyDataRowStyle-ForeColor="Red"
EmptyDataRowStyle-Font-Bold="true"
EmptyDataRowStyle-BorderStyle="None"
CssClass=" MyDataGridViewListThree"
HorizontalAlign="Center"
AllowSorting="true"
OnSorting="OnSortingReceipt"
RowStyle-CssClass="rows"
AutoGenerateColumns="false">
<EmptyDataRowStyle BorderStyle="None" Font-Bold="True" ForeColor="Red"></EmptyDataRowStyle>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle CssClass="rows"></RowStyle>
<Columns>
<asp:TemplateField HeaderText="Sr.No" ItemStyle-Width="30" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblRowNumber" Text='<%# Container.DataItemIndex + 1 %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="InvoiceDetail" HeaderText="Invoice No" ReadOnly="true"
ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="InvoiceType" HeaderText="Invoice Type" ReadOnly="true"
ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="InvoiceTypeCode" HeaderText="Type Code" ReadOnly="true"
ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="LedgerType" HeaderText="Ledger Type" ReadOnly="true"
ItemStyle-Wrap="False"></asp:BoundField>
</Columns>
</asp:GridView>
</div>
</div>
</asp:Panel>
<br />
<br />
</div>
<%-- End Un invoice List --%>
<%-- Start Payment Mode --%>
<div class=" container mb-0 mt-0 ">
<asp:Panel ID="PnlPaymentModelSelection" runat="server">
<div class="row g-0 text-center bg-primary">
<asp:Label ID="Label18" CssClass=" text-white fs-5 " runat="server" Text="Payment Mode"></asp:Label>
</div>
<div class="row g-0 fs-6 text-black" style="background-color: #31f90a">
<div class=" col-1 p-1 text-start border border-1">
<asp:Label ID="Label21" runat="server" Text="Invoice Value"></asp:Label>
</div>
<div class=" col-2 p-1 text-start border border-1">
<asp:Label ID="LblInvoiceValue" runat="server" Text="0"></asp:Label>
</div>
<div class=" col-1 p-1 text-start border border-1">
<asp:Label ID="Label23" runat="server" Text="Paid Amount"></asp:Label>
</div>
<div class=" col-2 p-1 text-start border border-1">
<asp:Label ID="LblPaidAmount" runat="server" Text="0"></asp:Label>
</div>
<div class=" col-1 p-1 text-start border border-1">
<asp:Label ID="Label24" runat="server" Text="Balance Amount"></asp:Label>
</div>
<div class=" col-2 p-1 text-start border border-1">
<asp:Label ID="LblBalanceAmount" runat="server" Text="0"></asp:Label>
</div>
<div class=" col-1 p-1 text-start border border-1" style="background-color: #f4f909">
<asp:Label ID="Label25" runat="server" Text="Customer Balance"></asp:Label>
</div>
<div class=" col-2 p-1 text-start border border-1" style="background-color: #f4f909">
<asp:Label ID="LblBalanceType" runat="server" Text=""></asp:Label>
<asp:Label ID="LblCustomerBalance" runat="server" Text="" Style="background-color: #f4f909"></asp:Label>
</div>
</div>
<div class="row g-0 bg_Entry_Color4 " style="background-color: #0cdaf6">
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label19" runat="server" Text="Payment Mode"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:DropDownList ID="DdlPaymentMode"
CssClass="form-select text-start w-75 mydropdownlist "
AutoPostBack="true" runat="server" OnSelectedIndexChanged="DdlPaymentMode_SelectedIndexChanged">
<asp:ListItem>SELECT</asp:ListItem>
<asp:ListItem Value="CA">CASH</asp:ListItem>
<asp:ListItem Value="TR">TRANSFER</asp:ListItem>
<asp:ListItem Value="CH">CHEQUE</asp:ListItem>
<asp:ListItem Value="DD">DEMAND DRAFT</asp:ListItem>
<asp:ListItem Value="PO">POS</asp:ListItem>
</asp:DropDownList>
</div>
</div>
</asp:Panel>
</div>
<%-- End Payment Mode --%>
<%-- Start Bank Account list --%>
<div class="container mb-0 mt-0 ">
<asp:Panel ID="PnlBankAccountList" runat="server">
<div class="row g-0 ">
<div class="col col-12 fs-5 text-white bg-primary text-center">
<asp:Label ID="LblPaymentMode" runat="server" Text="Payment Mode"></asp:Label>
</div>
</div>
<div class="row g-0 pt-0 " style="">
<div class="col col-12 justify-content-center">
<asp:GridView ID="GVBankAccountList" runat="server"
GridLines="Both"
EmptyDataText="No Record Found"
EmptyDataRowStyle-ForeColor="Red"
EmptyDataRowStyle-Font-Bold="true"
EmptyDataRowStyle-BorderStyle="None"
CssClass=" MyDataGridViewListFour"
HorizontalAlign="Center"
AllowSorting="true"
OnSorting="OnSortingBankAccount" OnRowDataBound="GVBankAccountList_RowDataBound"
RowStyle-CssClass="rows"
AutoGenerateColumns="false">
<EmptyDataRowStyle BorderStyle="None" Font-Bold="True" ForeColor="Red"></EmptyDataRowStyle>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle CssClass="rows"></RowStyle>
<Columns>
<asp:TemplateField HeaderText="Sr.No" ItemStyle-Width="30" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblRowNumber" Text='<%# Container.DataItemIndex + 1 %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Select">
<ItemTemplate>
<asp:LinkButton ID="LnkSelectAccount" runat="server" Text="Select" OnClick="ViewAccountDetail" ForeColor="Blue" Font-Size="14px" Font-Bold="true"
CommandArgument='<%# Eval("BankAccountName") + ";"
+ Eval("BankAccountNo") + ";"
+ Eval("BankName") + ";"
+ Eval("BankCode") + ";"
+ Eval("BankChargeCHQ") + ";"
+ Eval("BankChargePOS") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="BankAccountName" HeaderText="Account Name"
SortExpression="BankAccountName" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="BankAccountNo" HeaderText="Account No"
ItemStyle-Wrap="false"></asp:BoundField>
<asp:BoundField DataField="BankName" HeaderText="Bank Name"
SortExpression="BankName" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="BankCode" HeaderText="Bank Code"
SortExpression="BankCode" ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="BankChargeCHQ" ItemStyle-HorizontalAlign="Right" HeaderText="Bank Charge" ItemStyle-Width="80px"
ItemStyle-Wrap="False"></asp:BoundField>
<asp:BoundField DataField="BankChargePOS" ItemStyle-HorizontalAlign="Right" HeaderText="POS Charge" ItemStyle-Width="80px"
ItemStyle-Wrap="False"></asp:BoundField>
</Columns>
</asp:GridView>
</div>
</div>
<br />
<br />
</asp:Panel>
</div>
<%-- End Bank Account list --%>
<%-- Start Payment Detail --%>
<div class=" container mb-0 mt-0 ">
<asp:Panel ID="PnlPaymentDetail" runat="server">
<div class="row g-0 text-center bg-primary">
<asp:Label ID="Label31" CssClass=" text-white fs-5 " runat="server" Text="Payment Detail"></asp:Label>
</div>
<div class="row g-0 fs-6 text-black bg_Entry_Color5 ">
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label32" runat="server" Text="Bank Name"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtBankName" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="false"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator16" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtBankName" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label33" runat="server" Text="Bank Code"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtBankCode" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="false"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator17" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtBankCode" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label35" runat="server" Text="Bank Account No"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtBankAccountNo" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="false"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator19" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtBankAccountNo" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label34" runat="server" Text="Bank/POS Charges"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtBankPosCharges" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="false"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator18" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtBankPosCharges" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label45" runat="server" Text="Instrument No"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtInstrumentNo" CssClass="w-75 h-auto text-uppercase" AutoPostBack="false" runat="server"
AutoCompleteType="Disabled"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator23" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtInstrumentNo" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label46" runat="server" Text="Instrument Date"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtInstrumentDate" CssClass="w-75 h-auto text-uppercase" AutoPostBack="false" runat="server"
AutoCompleteType="Disabled"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator24" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtInstrumentDate" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label47" runat="server" Text="Instrument Bank"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtInstrumentBank" CssClass="w-75 h-auto text-uppercase" AutoPostBack="false" runat="server"
AutoCompleteType="Disabled"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator25" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtInstrumentBank" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label36" runat="server" Text="Receipt Amount"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtReceiptAmount" CssClass="w-75 h-auto text-uppercase" AutoPostBack="true" runat="server"
AutoCompleteType="Disabled" OnTextChanged="TxtReceiptAmount_TextChanged"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator20" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtReceiptAmount" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label42" runat="server" Text="Amount In LC"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtAmountInLc" CssClass="w-75 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled" ReadOnly="true" Enabled="false"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator21" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtAmountInLc" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
<div class=" col-3 p-1 text-start border border-1">
<asp:Label ID="Label43" runat="server" Text="Narration"></asp:Label>
</div>
<div class=" col-9 text-start border border-1 ">
<asp:TextBox ID="TxtNarration" CssClass="w-75 h-auto text-uppercase" TextMode="MultiLine" Height="200px" runat="server"
AutoCompleteType="Disabled"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator22" runat="server"
ErrorMessage="Required" ForeColor="Red" Font-Size="7"
SetFocusOnError="True" Display="Dynamic"
ControlToValidate="TxtNarration" ValidationGroup="Save"></asp:RequiredFieldValidator>
</div>
</div>
</asp:Panel>
</div>
<%-- End Payment Detial --%>
<%-- Start Save Entry --%>
<div class="container mb-0">
<asp:Panel ID="PnlSaveEntry" runat="server">
<div class="row g-0 " style="background-image: linear-gradient(to right, #e6d2fa ,#e6d2fa);">
<div class="col-12 d-flex justify-content-start">
<div style="background: lightgray">
<img id="loader3" style="display: none;" src="https://www.aspsnippets.com/demos/loader.gif" alt="" />
</div>
<asp:Button ID="BtnSave" runat="server"
CssClass="btn btn-info btn-outline-primary rounded-pill btn-lg "
ValidationGroup="Save"
ToolTip="Process Receipt" Text="Process Receipt"
OnClientClick="showLoader2();DisableClick; return ConfirmMessageOne(this) ; "
OnClick="BtnSave_Click" />
<%-- <asp:HiddenField ID="HfResponseOne" runat="server" ClientIDMode="Static" />
ConfirmOne(this);showLoader2();--%>
</div>
<%-- <div class="col-6 d-flex justify-content-end">
<div style="background: lightgray">
<img id="loader3" style="display: none;" src="https://www.aspsnippets.com/demos/loader.gif" alt="" />
</div>
<asp:Button ID="BtnUpdateCashier" CssClass="btn btn-warning btn-outline-secondary rounded-pill btn-lg "
OnClientClick="ConfirmTwo(this) ;showLoader3();"
runat="server" Text="Update Cashier" OnClick="BtnUpdateCashier_Click" />
<asp:HiddenField ID="HfResponseTwo" runat="server" ClientIDMode="Static" />
</div>--%>
</div>
</asp:Panel>
</div>
<%-- End Save Entry --%>
<%-- Start User Information --%>
<div class="container mb-0 mt-0 ">
<asp:Panel ID="PnlUser" runat="server">
<div class="row g-0 ">
<div class=" col-2 p-1 text-start Fs-14-User border border-dark bg_Entry_Colour8_UserDetails text-white">
<asp:Label ID="Label49" runat="server" Text="Company Code"></asp:Label>
</div>
<div class=" col-2 p-1 text-start Fs-14-User border border-dark bg_Entry_Colour8_UserDetails text-white">
<asp:TextBox ID="TxtUserCompanyCode" ReadOnly="true" CssClass="w-100 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled"></asp:TextBox>
</div>
<div class=" col-2 p-1 text-start Fs-14-User border border-dark bg_Entry_Colour8_UserDetails text-white">
<asp:Label ID="Label50" runat="server" Text="Company Name"></asp:Label>
</div>
<div class=" col-6 p-1 text-start Fs-14-User border border-dark bg_Entry_Colour8_UserDetails text-white">
<asp:TextBox ID="TxtUserCompanyName" ReadOnly="true" CssClass="w-100 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled"></asp:TextBox>
</div>
</div>
<div class="row g-0 ">
<div class=" col-2 p-1 text-start Fs-14-User border border-dark bg_Entry_Colour8_UserDetails text-white">
<asp:Label ID="Label48" runat="server" Text="Branch Code"></asp:Label>
</div>
<div class=" col-2 p-1 text-start Fs-14-User border border-dark bg_Entry_Colour8_UserDetails text-white">
<asp:TextBox ID="TxtUserBranchCode" ReadOnly="true" CssClass="w-100 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled"></asp:TextBox>
</div>
<div class=" col-2 p-1 text-start Fs-14-User border border-dark bg_Entry_Colour8_UserDetails text-white">
<asp:Label ID="Label51" runat="server" Text="Branch Name"></asp:Label>
</div>
<div class=" col-6 p-1 text-start Fs-14-User border border-dark bg_Entry_Colour8_UserDetails text-white">
<asp:TextBox ID="TxtUserBranchName" ReadOnly="true" CssClass="w-100 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled"></asp:TextBox>
</div>
</div>
<div class="row g-0 ">
<div class=" col-2 p-1 text-start Fs-14-User border border-dark bg_Entry_Colour8_UserDetails text-white">
<asp:Label ID="Label38" runat="server" Text="User Name"></asp:Label>
</div>
<div class=" col-10 p-1 text-start Fs-14-User border border-dark bg_Entry_Colour8_UserDetails text-white">
<asp:TextBox ID="TxtUserName" ReadOnly="true" CssClass="w-100 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled"></asp:TextBox>
</div>
</div>
<div class="row g-0 ">
<div class=" col-2 p-1 text-start Fs-14-User border border-dark bg_Entry_Colour8_UserDetails text-white text-bg-secondary ">
<asp:Label ID="Label39" runat="server" Text="User Id"></asp:Label>
</div>
<div class=" col-10 p-1 text-start Fs-14-User border border-dark bg_Entry_Colour8_UserDetails text-white">
<asp:TextBox ID="TxtUserId" ReadOnly="true" CssClass="w-100 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled"></asp:TextBox>
</div>
</div>
<div class="row g-0 ">
<div class=" col-2 p-1 text-start Fs-14-User border border-dark bg_Entry_Colour8_UserDetails text-white">
<asp:Label ID="Label41" runat="server" Text="User Email Id"></asp:Label>
</div>
<div class=" col-10 p-1 text-start Fs-14-User border border-dark bg_Entry_Colour8_UserDetails text-white">
<asp:TextBox ID="TxtUserEmailId" ReadOnly="true" CssClass=" w-100 h-auto text-uppercase" runat="server"
AutoCompleteType="Disabled"></asp:TextBox>
</div>
</div>
</asp:Panel>
</div>
<%-- End User Information --%>
<%--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$(document).keydown(function (e) {
return (e.which || e.keyCode) != 116;
});
});
</script>
--%>
</asp:Content>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Net.Mail;
using System.Configuration;
using System.Web.Configuration;
using System.Net.Configuration;
using System.Net.Sockets;
using System.Net.Security;
using System.Data;
using System.Data.SqlClient;
using System.Threading.Tasks;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Globalization;
using System.IO;
using System.Drawing;
using iTextSharp.text;
using iTextSharp.text.html.simpleparser;
using iTextSharp.text.pdf;
public partial class ServiceCashCollection : System.Web.UI.Page
{
SqlConnection SqlCn;
SqlCommand SqlCm;
SqlDataReader SqlDr;
SqlDataAdapter SqlDa;
DataTable SqlDt;
SqlTransaction SqlTrans;
ConnectionState ConState;
static string SqlQry;
static string ConPath;
// End Sql connection
static string LoginName;
static string LoginPassword;
static int LoginId;
static string LoginEmailId;
static string LoginEmailIdPassword;
static string LoginPhoneNo;
static string LoginRole;
static string FormNoFormAcess;
static int ModuleNoFormAccess;
static int LoginIdFormAccess;
// End Login
static int MainCompanyCode;
static string MainCompanyName;
static string MainCompanyNick;
static string MainCompanyType;
static string CompanyActiveStatus;
static string StdDatabaseName;
static string FullCompanyName;
static string SalesCurrencyName;
static string SalesCurrencyNameSecond;
static string ServiceCurrencyName;
static string ServiceCurrencyNameSecond;
static string CountryNameShort;
static string CountryNameFull;
static string CountryPhoneStd;
static string LessPaymentLimit;
static string CompanyTinNo;
static string CompanyRcNo;
static string CostingMethod;
// End Company Detail
static int MainBranchCode;
static string MainBranchName;
static string MainBranchNick;
static string MainLocation;
static string MainBranchPhoneNo;
static string Tax1Name;
static string Tax2Name;
static string Tax3Name;
static string TaxStandard;
static double Tax1PerSales;
static double Tax2PerSales;
static double Tax3PerSales;
static double Tax1PerService;
static double Tax2PerService;
static double Tax3PerService;
static double Tax1PerParts;
static double Tax2PerParts;
static double Tax3PerParts;
static double MaximumDiscountPercent;
static double SubletPercent;
static string Regional;
static string BranchAddress1;
static string BranchAddress2;
static string SalesCallType;
static string BranchValid;
static string DiscountPosition;
// End Branch Detail
static int CustomerCode;
static string CustomerName;
static string CustomerCodeDuplicate;
static string CustomerTitle;
static string CustomerIdentity;
static string CustomerContactPersonName;
static string CustomerContactPersonDesignation;
static string CustomerContactPersonPhoneNo;
static string CustomerFirstName;
static string CustomerMiddleName;
static string CustomerLastName;
static string CustomerType;
static string CustomerGroup;
static string CustomerGender;
static string CustomerDOB;
static string CustomerDOM;
static string CustomerAddress1;
static string CustomerAddress2;
static string CustomerCityCode;
static string CustomerZipCode;
static string CustomerPBNo;
static string CustomerStateCode;
static string CustomerCountryCode;
static string CustomerCountryName;
static string CustomerPhoneNo;
static string CustomerMobileNo;
static string CustomerEmailId;
static string CustomerActiveStatus;
static string CustomerCreditLimitStatus;
static string CustomerTaxCategory;
static string CustomerTaxID;
static string CustomerVatNo;
static string CustomerTinNo;
static Boolean CustomerFound;
static double CustomerBalance;
// End Customer Vaiable
static string ContactPersonNameShip;
static string ContactPersonDesignationShip;
static string Address1Ship;
static string Address2Ship;
static string CityCodeShip;
static string PBNoShip;
static string GenderShip;
static string StateCodeShip;
static string MobileNoShip;
static string EmailIdShip;
static string AddressType;
// End Customer Address Vaiable
static string InvoiceNoDetail;
static string InvoiceDate;
static string InvoiceStatus;
static double PartsAmount;
static double LabourAmount;
static double TotalAmount;
static double DiscountAmountParts;
static double DiscountAmountLabour;
static double DiscountAmount;
static double Tax1AmountParts;
static double Tax2AmountParts;
static double Tax3AmountParts;
static double Tax1AmountService;
static double Tax2AmountService;
static double Tax3AmountService;
static double TaxAmount;
static double NetAmount;
static double InvoiceAmount;
static string InvoiceCancelStatus;
static string InvoiceTypeName;
static string InvoiceTypeCode;
static string InvoiceCancelDate;
static string InvoiceCancelRemark;
static string InvoiceRemark;
static string InvoicePaymentMode;
static double PaidAmount;
static double BalanceAmount;
static double InvoiceReceivableAmount = 0;
// End Invoice
static int BrandCode;
static string BrandName;
static string BrandNickName;
static int ModelGroupCode;
static string ModelGroupName;
static int ModelCode;
static double EngineCapacity;
static string ModelName;
static int ModelYear;
static string ColourOEMCode;
static int ColourCode;
static string ColourName;
static string RegNo;
static string ChassisNo;
static string EngineNo;
static string Transmission;
static string KeyCode;
static string RadioCode;
static string SaleType;
static int Mileage;
static string Specs;
static double ModelRetailPrice;
static double ModelSalesPrice;
static double ModelManagementPrice;
static string ModelCurrency;
static string SoldDate;
static string DeliveryNoteNo;
// End Vehicle
static string JobNoDetail;
static string JobNoDate;
// End Job Card Detail
static string BankCode;
static string BankName;
static string BankAccountNo;
static string BankAccountName;
static string BankDetailsNarration;
// End Bank Variable
static string CashierName;
static int CashierId;
// End Cashier Detail
//static string ReceiptDetail;
static string ReceiptNoGenerated;
static string ReceiptType; //Colection or Advance
static string ReceiptPaymentModeShort; // CA,CH.PO.TR
static string ReceiptPaymentMode; // Cash or Bank
static double ReceiptAmount = 0;
static double ReceiptAllocatedAmount = 0;
static double ReceiptBalanceAmount = 0;
static double ReceiptAmountInLc = 0;
static double ReceiptNewBalance = 0;
static double ReceiptPreviousBalance = 0;
static string TmpReceiptNo = "";
// End Receipt Detail
static string CurrencyNameForExchangeRate = "";
static string CurrencyName;
static string CurrencyType = "";
static int CurrencyCalculation = 0;
static double ExchangeRate = 0;
// End Currency
static Boolean TransactionStatus;
static string TodayDate;
static string SearchParameterString1;
static string SearchParameterString2;
static string SearchParameterString3;
static int SearchParameterNumber1;
static int SearchParameterNumber2;
static int SearchParameterNumber3;
static int CheckedCounter;
static int LastNo;
static int TotalRowCount;
static int TotalColCount;
static string InvoiceCategory;
static string SearchModeOption;
static string SearchMode;
static string PaymentCategory;
static string MessageTitle;
static string VoucherUniqueId;
static int DepartmentCode;
static string TransactionDate;
static string TransactionTime;
static string Narration;
static string UserIdandName;
static string EntryBy;
static string GatepassApprovedStatus;
// End Other Vaiable
static string SwalTitle; // Transaction
static string SwalShowMessage; // Display User Message
static string SwalMessageType; // error , info warning success
static string SwalErrorServerSide; // message capture from server side
//static string MessangeTitle;
// End SWAL Message
protected void Page_Load(object sender, EventArgs e)
{
//ClearText
//ClearGridView
//ClearDdl
//ClearRbtn
//// =========== Start For Session Time Out ========================================
//Response.Cache.SetCacheability(HttpCacheability.NoCache);
//// =========== Start For Session Time Out ========================================
this.Form.Enctype = "multipart/form-data";
if (Session["LoginId".Trim()] == null || Session["MainBranchCode".Trim()] == null)
{
//ClientScript.RegisterClientScriptBlock(this.GetType(), "alert",
//"swal('Information!', 'Session expired', 'info')", true);
//Response.Redirect("https://stallionautoghana.com/LoginPage.aspx");
//return;
}
else
{
if (!IsPostBack)
{
//// =========== Start For Session Time Out ========================================
//Session["Reset"] = true;
//Configuration config = WebConfigurationManager.OpenWebConfiguration("~/Web.Config");
//SessionStateSection section = (SessionStateSection)config.GetSection("system.web/sessionState");
//int timeout = (int)section.Timeout.TotalMinutes * 1000 * 60;
//ClientScript.RegisterStartupScript(this.GetType(), "SessionAlert", "SessionExpireAlert(" + timeout + ");", true);
//// =========== Start For Session Time Out ========================================
ClearDdl(PnlOption);
PnlSearchAdvance.Visible = false;
PnlSearchCollection.Visible = false;
PnlCustomerList.Visible = false;
PnlInvoiceList.Visible = false;
PnlInvoiceDetail.Visible = false;
PnlCustomerDetail.Visible = false;
PnlVehicleDetail.Visible = false;
PnlReceiptList.Visible = false;
PnlPendingInvoiceList.Visible = false;
PnlPaymentModelSelection.Visible = false;
PnlBankAccountList.Visible = false;
PnlPaymentDetail.Visible = false;
PnlSaveEntry.Visible = false;
ClearText(PnlSearchAdvance);
ClearRbtn(PnlSearchAdvance);
ClearText(PnlSearchCollection);
ClearRbtn(PnlSearchCollection);
ClearGridView(PnlCustomerList);
ClearGridView(PnlInvoiceList);
ClearText(PnlInvoiceDetail);
ClearText(PnlCustomerDetail);
ClearText(PnlVehicleDetail);
ClearGridView(PnlReceiptList);
ClearGridView(PnlPendingInvoiceList);
ClearDdl(PnlPaymentModelSelection);
ClearGridView(PnlBankAccountList);
ClearText(PnlPaymentDetail);
ClearText(PnlSaveEntry);
DdlCurrency.SelectedIndex = 1;
DdlInvoiceCategory.SelectedIndex = 0;
GetSessionDetail();
this.GetSqlServerDate();
DateTime date = DateTime.ParseExact(TodayDate, "dd-MM-yyyy", null);
TransactionStatus = false;
this.FormAccessValidity();
if (TransactionStatus == true)
{
GetCashierStatus();
InvoiceCategory = "NOInvoiceCategory";
SearchModeOption = "NOSearchMode";
LoadCurrencyList();
LblStdCurrencyName.Text = ServiceCurrencyName;
DdlCurrency.SelectedValue = ServiceCurrencyName;
TxtExchnageRate.Text = "1";
}
else
{
MessageTitle = "Page Access Denied ";
ShowMsgAndRedirectHomePage();
}
}
// End Post Back
}
// End Session
}
// End Page Load
// ======================================== Start Common Function =====================
protected void GetSessionDetail()
{
LoginRole = (string)Session["LoginRole"];
LoginName = (string)Session["LoginName"];
LoginId = (int)Session["LoginId"];
LoginEmailId = (string)Session["LoginEmailId"];
LoginPhoneNo = (string)Session["LoginPhoneNo"];
MainCompanyCode = (int)Session["MainCompanyCode"];
MainCompanyName = (string)Session["MainCompanyName"];
MainCompanyCode = (int)Session["MainCompanyCode"];
MainCompanyName = (string)Session["MainCompanyName"];
MainCompanyNick = (string)Session["MainCompanyNick"];
MainCompanyType = (string)Session["MainCompanyType"];
CompanyActiveStatus = (string)Session["CompanyActiveStatus"];
StdDatabaseName = (string)Session["StdDatabaseName"];
FullCompanyName = (string)Session["FullCompanyName"];
SalesCurrencyName = (string)Session["SalesCurrencyName"];
SalesCurrencyNameSecond = (string)Session["SalesCurrencyNameSecond"];
ServiceCurrencyName = (string)Session["ServiceCurrencyName"];
ServiceCurrencyNameSecond = (string)Session["ServiceCurrencyNameSecond"];
CountryNameShort = (string)Session["CountryNameShort"];
CountryNameFull = (string)Session["CountryNameFull"];
CountryPhoneStd = (string)Session["CountryPhoneStd"];
LessPaymentLimit = (string)Session["LessPaymentLimit"];
CompanyTinNo = (string)Session["CompanyTinNo"];
CompanyRcNo = (string)Session["CompanyRcNo"];
CostingMethod = (string)Session["CostingMethod"];
// End Company Detail
MainBranchCode = (int)Session["MainBranchCode"];
MainBranchName = (string)Session["MainBranchName"];
MainBranchPhoneNo = (string)Session["MainBranchPhoneNo"];
Tax1Name = (string)Session["Tax1Name"];
Tax2Name = (string)Session["Tax2Name"];
Tax3Name = (string)Session["Tax3Name"];
TaxStandard = (string)Session["TaxStandard"];
Tax1PerSales = (double)Session["Tax1PerSales"];
Tax2PerSales = (double)Session["Tax2PerSales"];
Tax3PerSales = (double)Session["Tax3PerSales"];
Tax1PerService = (double)Session["Tax1PerService"];
Tax2PerService = (double)Session["Tax2PerService"];
Tax3PerService = (double)Session["Tax3PerService"];
Tax1PerParts = (double)Session["Tax1PerParts"];
Tax2PerParts = (double)Session["Tax2PerParts"];
Tax3PerParts = (double)Session["Tax3PerParts"];
MaximumDiscountPercent = (double)Session["MaximumDiscountPercent"];
SubletPercent = (double)Session["SubletPercent"];
Regional = (string)Session["Regional"];
BranchAddress1 = (string)Session["BranchAddress1"];
BranchAddress2 = (string)Session["BranchAddress2"];
SalesCallType = (string)Session["SalesCallType"];
BranchValid = (string)Session["BranchValid"];
MainBranchNick = (string)Session["MainBranchNick"];
MainLocation = (string)Session["MainLocation"];
DiscountPosition = (string)Session["DiscountPosition"];
// End Branch Detail
TxtUserCompanyCode.Text = MainCompanyCode.ToString();
TxtUserCompanyName.Text = MainCompanyName;
TxtUserBranchCode.Text = MainBranchCode.ToString();
TxtUserBranchName.Text = MainBranchName;
UserDetail();
}
// End Session Variavle
protected void UserDetail()
{
LoginRole = (string)Session["LoginRole"];
LoginName = (string)Session["LoginName"];
LoginId = (int)Session["LoginId"];
LoginEmailId = (string)Session["LoginEmailId"];
LoginPhoneNo = (string)Session["LoginPhoneNo"];
TxtUserName.Text = LoginName;
TxtUserEmailId.Text = LoginEmailId;
TxtUserId.Text = LoginId.ToString();
}
// End User Details
protected void Page_Init(object sender, EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
Response.Cache.SetNoStore();
}
// Stop prevent Back button browser
// Start Show Message and redirect to home page
protected void ShowMsgAndRedirectHomePage()
{
string message = MessageTitle + " You will redirect to home page ";
string url = "Home.aspx";
string script = "window.onload = function(){ alert('";
script += message;
script += "');";
script += "window.location = '";
script += url;
script += "'; }";
ClientScript.RegisterStartupScript(this.GetType(), "Redirect", script, true);
}
// End Show Message and redirect to home page
// start message script
protected void MessageScript()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script type = 'text/javascript'>");
sb.Append("window.onload=function(){");
sb.Append("alert('");
sb.Append(MessageTitle);
sb.Append("')};");
sb.Append("</script>");
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());
}
// End Message Script
// Start Script With Update Panel
protected void MessageScriptWithUpdatePanel()
{
// With Panel Update
ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('" + MessageTitle + "');window.location='';", true);
}
// End Script With Update Panel
// Start Get Sql Server Date
protected void GetSqlServerDate()
{
MainClass ClassOject = new MainClass(); // Create Class Object
MainClass.TodateDateClass = ClassOject.GetServerDate(); // Pass Variable into class function
TodayDate = MainClass.TodateDateClass; // Define Class variable Value into Local Variable
}
// End Sql Server Date
// Start Form Access
protected void FormAccessValidity()
{
ModuleNoFormAccess = 40;
FormNoFormAcess = "4020201010";
LoginIdFormAccess = int.Parse(LoginId.ToString());
TransactionStatus = false; // Local Vaiable
MainClass ClassOject = new MainClass(); // Create Class Object
MainClass.TransactionStatusClass = ClassOject.AccessFormClass(LoginIdFormAccess, FormNoFormAcess, ModuleNoFormAccess); // Pass Variable into class function
TransactionStatus = MainClass.TransactionStatusClass; // Define Class variable Value into Local Variable
}
// End Form Access
// Start connection string
protected void ConnectionStringFunction()
{
// Start Connection String From Class
MainClass ClassObj = new MainClass(); // Class Object
//<Class> <ObjectName>= new <ClassFileName>;
MainClass.ConPathClass = ClassObj.GetConnectionForClass(); //Connection path from Class
//Define Function Return Value
//<ClassName>.<Variable>=<ClassObject>.<FunctionName()>;
MainClass.ConPathClass = MainClass.ConPathClass.ToString();
ConPath = MainClass.ConPathClass.ToString();
//End Connection String From Class
try
{
SqlCn = new SqlConnection(ConPath);
SqlCn.Open();
ConState = SqlCn.State;
SqlCn.Close();
if (ConState == ConnectionState.Closed || ConState == ConnectionState.Broken)
{
TransactionStatus = false;
}
else
{
TransactionStatus = true;
}
}
// End Try
catch (Exception ex)
{
TransactionStatus = false;
MessageTitle = "Data Base Connection Error " + ex.ToString();
}
finally
{
SqlCn.Close();
}
}
//End Connection String From Class
public void SwalErrorMessageDisplay()
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert",
"swal('" + SwalTitle + "','" + SwalShowMessage + "', '" + SwalMessageType + "' )", true);
}
// End Swal Message
private void ClearText(Panel PnlId)
{
foreach (Control c in PnlId.Controls)
{
if (c is TextBox)
{
TextBox AllItem = c as TextBox;
if (AllItem != null)
{
AllItem.Text = "";
}
}
}
}
// End clear all text box
private void ClearGridView(Panel PnlId)
{
foreach (Control c in PnlId.Controls)
{
if (c is GridView)
{
GridView AllItem = c as GridView;
if (AllItem != null)
{
AllItem.DataSource = null;
AllItem.DataBind();
}
}
}
}
// End clear all GridView
private void ClearDdl(Panel PnlId)
{
foreach (Control c in PnlId.Controls)
{
if (c is DropDownList)
{
DropDownList AllItem = c as DropDownList;
if (AllItem.SelectedIndex != 0)
{
AllItem.SelectedIndex = 0;
}
}
}
}
//// End clear all DDL
private void ClearRbtn(Panel PnlId)
{
foreach (Control c in PnlId.Controls)
{
if (c is RadioButton)
{
RadioButton AllItem = c as RadioButton;
if (AllItem.Checked == true)
{
AllItem.Checked = false;
}
}
}
}
//// End clear all DDL
private string SortDirection
{
get { return ViewState["SortDirection"] != null ? ViewState["SortDirection"].ToString() : "ASC"; }
set { ViewState["SortDirection"] = value; }
}
//==================================== End Common Function -1 ==============================================//
protected void OnSortingInvoiceList(object sender, GridViewSortEventArgs e)
{
this.SortDirection = this.SortDirection == "ASC" ? "DESC" : "ASC";
this.LoadInvoiceList(e.SortExpression);
}
// End Sort functions
protected void OnSortingReceipt(object sender, GridViewSortEventArgs e)
{
this.LoadReceiptList(e.SortExpression);
}
protected void OnSortingBankAccount(object sender, GridViewSortEventArgs e)
{
LoadBankAccountList(e.SortExpression);
}
//==================================== End Sort Function ==================================================//
protected void GetCashierStatus()
{
LblCashierActiveStatus.Text = "";
try
{
ConnectionStringFunction();
SqlCn = new SqlConnection(ConPath);
SqlCn.Open();
SqlQry = "Select top(1) CashierName,CashierLocation, iif(ActiveStatus='Y', 'ACTIVE','IN-ACTIVE') as ActiveStatus From CashierList Where CashierId=@CashierId and CashierLocation=@MainLocation ";
SqlCm = new SqlCommand(SqlQry, SqlCn); // PermissionForm
SqlCm.CommandType = CommandType.Text;
SqlCm.Parameters.AddWithValue("@CashierId", int.Parse(TxtUserId.Text));
SqlCm.Parameters.AddWithValue("@MainLocation", MainLocation);
SqlDr = SqlCm.ExecuteReader();
if (SqlDr.HasRows)
{
if (SqlDr.Read())
{
LblCashierActiveStatus.Text = SqlDr["ActiveStatus"].ToString();
}
}
else
{
LblCashierActiveStatus.Text = "CASHIER PROFILE NOT EXISTS";
TransactionStatus = false;
}
// end has Row
}
catch (Exception ex)
{
TransactionStatus = false;
}
// Catch
finally
{
SqlCn.Close();
}
// End Finally
}
// end cashier status
protected void LoadCurrencyList()
{
DdlCurrency.Items.Clear();
DdlCurrency.DataSource = null;
DdlCurrency.DataBind();
try
{
ConnectionStringFunction(); // Function Call
SqlCn = new SqlConnection(ConPath);
SqlCn.Open();
SqlQry = "SELECT CurrencyName,CurrencyType,CurrencyCalculation from CurrencyList Where ActiveStatus='Y' Order By Currencycode ";
SqlCm = new SqlCommand(SqlQry, SqlCn);
SqlCm.CommandType = CommandType.Text;
DdlCurrency.DataSource = SqlCm.ExecuteReader();
DdlCurrency.DataTextField = "CurrencyName";
DdlCurrency.DataValueField = "CurrencyName";
DdlCurrency.DataBind();
DdlCurrency.Items.Insert(0, "SELECT");
DdlCurrency.SelectedIndex = -1;
TransactionStatus = true;
}
// End Try
catch (Exception ex)
{
MessageTitle = " Error Get Currency List " + ex.ToString();
//MessageScript();
MessageScriptWithUpdatePanel();
return;
}
// Catch
finally
{
SqlCn.Close();
}
// End Finally
}
// Load Currency
protected void DdlCurrency_SelectedIndexChanged(object sender, EventArgs e)
{
if (DdlCurrency.SelectedIndex <= 0)
{
TxtExchnageRate.Text = "0";
}
else
{
if (DdlCurrency.Text == LblStdCurrencyName.Text)
{
TxtExchnageRate.Text = "1";
}
else
{
ClearRbtn(PnlSearchCollection);
ClearText(PnlSearchCollection);
CurrencyNameForExchangeRate = DdlCurrency.SelectedValue;
GetExchangeRate();
}
}
}
// End Selection currency
protected void GetExchangeRate()
{
if (DdlCurrency.SelectedIndex <= 0)
{
ExchangeRate = 0;
}
else
{
CurrencyNameForExchangeRate = DdlCurrency.SelectedValue;
if (CurrencyNameForExchangeRate == ServiceCurrencyName)
{
ExchangeRate = 1;
}
else
{
MainClass ClassObjExchangeRate = new MainClass();
MainClass.TransactionStatusClass = ClassObjExchangeRate.GetExchangeRateFromClass(CurrencyNameForExchangeRate);
ExchangeRate = MainClass.CurrencyExchangeRateClass;
}
}
TxtExchnageRate.Text = ExchangeRate.ToString("#,##0.00");
if (Convert.ToDouble(TxtExchnageRate.Text) == 0)
{
SwalTitle = "Information !!";
SwalShowMessage = "Exchange Rate Required !!";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
}
// End Exchange Rate
protected void DdlInvoiceCategory_SelectedIndexChanged(object sender, EventArgs e)
{
ClearText(PnlSearchCollection);
//ClearRbtn(PnlSearch);
if (DdlInvoiceCategory.SelectedIndex <= 0)
{
InvoiceCategory = "NOInvoice";
}
else
{
InvoiceCategory = DdlInvoiceCategory.SelectedValue;
}
if (InvoiceCategory == "COUNTER SALE")
{
RbtnJobOrderCollection.Checked = false;
RbtnVehicleCollection.Checked = false;
RbtnVehicleAdvance.Checked = false;
RbtnCustomerAdvance.Checked = false;
RbtnJobOrderCollection.Enabled = false;
RbtnVehicleCollection.Enabled = false;
RbtnVehicleAdvance.Enabled = false;
}
else
{
RbtnJobOrderCollection.Enabled = true;
RbtnVehicleCollection.Enabled = true;
RbtnVehicleAdvance.Enabled = true;
RbtnCustomerAdvance.Enabled = true;
}
}
// end ddl invoice category
protected void DdlPaymentCategory_SelectedIndexChanged(object sender, EventArgs e)
{
LblInvoiceValue.Text = "0";
LblPaidAmount.Text = "0";
LblBalanceAmount.Text = "0";
LblCustomerBalance.Text = "0";
LblPaymentMode.Text = "Payment Mode : NA";
PnlSearchAdvance.Visible = false;
PnlSearchCollection.Visible = false;
PnlCustomerList.Visible = false;
PnlInvoiceList.Visible = false;
PnlInvoiceDetail.Visible = false;
PnlCustomerDetail.Visible = false;
PnlVehicleDetail.Visible = false;
PnlReceiptList.Visible = false;
PnlPendingInvoiceList.Visible = false;
PnlPaymentModelSelection.Visible = false;
PnlBankAccountList.Visible = false;
PnlPaymentDetail.Visible = false;
PnlSaveEntry.Visible = false;
if (DdlPaymentCategory.SelectedIndex <= 0)
{
// Select
PnlSearchCollection.Visible = false;
PnlSearchAdvance.Visible = false;
PnlInvoiceList.Visible = false;
}
if (DdlPaymentCategory.SelectedIndex == 1)
{
// Collection
PaymentCategory = DdlPaymentCategory.SelectedValue;
PnlSearchCollection.Visible = true;
PnlSearchAdvance.Visible = false;
PnlInvoiceList.Visible = false;
PnlCustomerList.Visible = false;
}
if (DdlPaymentCategory.SelectedIndex == 2)
{
// Advance
PaymentCategory = DdlPaymentCategory.SelectedValue;
PnlSearchAdvance.Visible = true;
PnlCustomerList.Visible = false;
PnlSearchCollection.Visible = false;
PnlInvoiceList.Visible = false;
}
}
// end ddl payment category
protected void BtnSearchCollection_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(1000);
LblInvoiceValue.Text = "0";
LblPaidAmount.Text = "0";
LblBalanceAmount.Text = "0";
LblCustomerBalance.Text = "0";
LblPaymentMode.Text = "Payment Mode : NA";
PnlSearchAdvance.Visible = false;
PnlSearchCollection.Visible = true;
PnlCustomerList.Visible = false;
PnlInvoiceList.Visible = true;
PnlInvoiceDetail.Visible = true;
PnlCustomerDetail.Visible = true;
PnlVehicleDetail.Visible = true;
PnlReceiptList.Visible = true;
PnlPendingInvoiceList.Visible = true;
PnlPaymentModelSelection.Visible = true;
PnlBankAccountList.Visible = true;
PnlPaymentDetail.Visible = true;
PnlSaveEntry.Visible = true;
//ClearText(PnlSearchAdvance);
//ClearRbtn(PnlSearchAdvance);
//ClearText(PnlSearchCollection);
//ClearRbtn(PnlSearchCollection);
ClearGridView(PnlCustomerList);
ClearGridView(PnlInvoiceList);
ClearText(PnlInvoiceDetail);
ClearText(PnlCustomerDetail);
ClearText(PnlVehicleDetail);
ClearGridView(PnlReceiptList);
ClearGridView(PnlPendingInvoiceList);
ClearDdl(PnlPaymentModelSelection);
ClearGridView(PnlBankAccountList);
ClearText(PnlPaymentDetail);
ClearText(PnlSaveEntry);
if (DdlCurrency.SelectedIndex <= 0)
{
SwalTitle = "Warning !!";
SwalShowMessage = "Select Currency ";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (Convert.ToDouble(TxtExchnageRate.Text) == 0)
{
SwalTitle = "Information !!";
SwalShowMessage = "Exchange Rate Required !!";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (DdlInvoiceCategory.SelectedIndex <= 0)
{
SwalTitle = "Warning !!";
SwalShowMessage = "Select Invoice Catagory";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (Convert.ToDouble(TxtExchnageRate.Text) == 0 || TxtExchnageRate.Text == "")
{
SwalTitle = "Warning !!";
SwalShowMessage = "Check Exchange Rate";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (RbtnInvoiceCollection.Checked == false && RbtnJobOrderCollection.Checked == false && RbtnVehicleCollection.Checked == false)
{
SwalTitle = "Warning !!";
SwalShowMessage = "Select Search Option";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (RbtnInvoiceCollection.Checked == true)
{
//ClearRbtn(PnlSearch);
SearchModeOption = "INVOICE";
}
if (RbtnJobOrderCollection.Checked == true)
{
//ClearRbtn(PnlSearch);
SearchModeOption = "REPAIR ORDER";
}
if (RbtnVehicleCollection.Checked == true)
{
//ClearRbtn(PnlSearch);
SearchModeOption = "REGNO";
}
if (TxtSearchValueCollection.Text == "" || TxtSearchValueCollection.Text.Length < 2)
{
SwalTitle = "Warning !!";
SwalShowMessage = "Provide Search Value";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
InvoiceCategory = DdlInvoiceCategory.Text;
LoadInvoiceList();
//TestProcedureWithMultipleQuery();
}
// End Search
protected void TestProcedureWithMultipleQuery()
{
ConnectionStringFunction();
SqlCn = new SqlConnection(ConPath);
SqlCn.Open();
string NewEntry = "Entry By : " +
TxtUserId.Text.Trim() + "-" +
TxtUserName.Text.Trim() + " " + DateTime.Now.Date.ToString("dd-MM-yyyy");
//SqlCommand cmd1, cmd2;
SqlCm = new SqlCommand("usp_InsertData", SqlCn);
//SqlCm.Parameters.AddWithValue("InvoiceCategory", InvoiceCategory);
//SqlCm.Parameters.AddWithValue("@UserName", TxtUserName.Text);
//cmd2 = new SqlCommand("sp2", con);
SqlTransaction trans = SqlCn.BeginTransaction();
SqlCm.Transaction = trans;
//cmd2.Transaction = trans;
try
{
SqlCm.ExecuteNonQuery();
//cmd2.ExecuteNonQuery();
trans.Commit();
}
catch (Exception ex)
{
MessageTitle = "Failed Transaction : " + ex.Message.ToString();
//MessageScript();
SwalTitle = "Transaction Failed : Error !!";
SwalShowMessage = "SAVE RECEIPT " + ex.Message.ToString();
SwalMessageType = "error"; // info error warning
SwalErrorMessageDisplay();
// return;
trans.Rollback();
}
//try
//{
//SqlCommand SqlCm = new SqlCommand("usp_InsertData", SqlCn);
//SqlCm.CommandType = CommandType.StoredProcedure;
//SqlCm.Connection = SqlCn;
//SqlCm.ExecuteNonQuery();
//TransactionStatus = true;
//}
//// End Try
//catch (Exception ex)
//{
// TransactionStatus = false;
//}
//// Catch
//finally
//{
// SqlCn.Close();
//}
//// End Finally
}
// End Test procedure
protected void LoadInvoiceList(string sortExpression = null)
{
MainBranchCode = int.Parse(TxtUserBranchCode.Text);
MainCompanyCode = int.Parse(TxtUserCompanyCode.Text);
GridView GvList = new GridView();
if (DdlPaymentCategory.SelectedValue == "COLLECTION")
{
GvList = GVInvoiceList;
}
if (DdlPaymentCategory.SelectedValue == "ADVANCE")
{
GvList = GvCustomerList;
}
ConnectionStringFunction();
SqlCn = new SqlConnection(ConPath);
SqlCn.Open();
MainClass.ProcNameClass = "InvoiceListForReceipt";
if (DdlPaymentCategory.SelectedValue == "COLLECTION")
{
SearchParameterString1 = TxtSearchValueCollection.Text.Trim();
}
else
{
SearchParameterString1 = TxtSearchValueAdvance.Text.Trim();
}
try
{
SqlCm = new SqlCommand(MainClass.ProcNameClass, SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("InvoiceCategory", InvoiceCategory);
SqlCm.Parameters.AddWithValue("SearchMode", SearchModeOption);
SqlCm.Parameters.AddWithValue("MainbranchCode", MainBranchCode);
SqlCm.Parameters.AddWithValue("SearchValue", SearchParameterString1);
SqlCm.Parameters.AddWithValue("PaymentCategory", PaymentCategory);
SqlCm.Parameters.AddWithValue("MainCompanyCode", MainCompanyCode);
SqlDa = new SqlDataAdapter(SqlCm);
SqlDt = new DataTable();
SqlDa.Fill(SqlDt);
if (sortExpression != null)
{
DataView dv = SqlDt.AsDataView();
this.SortDirection = this.SortDirection == "ASC" ? "DESC" : "ASC";
dv.Sort = sortExpression + " " + this.SortDirection;
//GVInvoiceList.DataSource = dv;
GvList.DataSource = dv;
}
else
{
//GVInvoiceList.DataSource = SqlDt;
GvList.DataSource = SqlDt;
}
//GVInvoiceList.DataBind();
GvList.DataBind();
//TotalRowCount = GVInvoiceList.Rows.Count;
//GVInvoiceList.Caption = "Invoice List : " + TotalRowCount.ToString();
//GVInvoiceList.CssClass = "MyDataGridViewListOne";
//TotalColCount = GvPendingList.Columns.Count;
//for (int i = 0; i <= TotalColumnCount - 1; i++)
//{
// GvStaffList.Columns[i].ItemStyle.Wrap = false;
//}
TransactionStatus = true;
}
// End Try
catch (Exception ex)
{
TransactionStatus = false;
}
// Catch
finally
{
SqlCn.Close();
}
// End Finally
}
// End Load Invoice
protected void GVInvoiceList_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
foreach (TableCell cell in e.Row.Cells)
{
double BalanceTmp = Convert.ToDouble(e.Row.Cells[7].Text);
if (BalanceTmp == 0)
{
cell.ForeColor = Color.Red;
cell.BackColor = Color.LightYellow;
//cell.Font.Bold = true;
}
else
{
cell.ForeColor = Color.Black;
//cell.BackColor = Color.LightGreen;
cell.Font.Bold = false;
}
}
}
}
// End Rowdatabound invoice detail
protected void ViewInvoiceDetail(object sender, EventArgs e)
{
////int id = int.Parse((sender as LinkButton).CommandArgument);
//string id = (sender as LinkButton).CommandArgument;
LinkButton lnkRowSelection = (LinkButton)sender;
string[] arguments = lnkRowSelection.CommandArgument.Split(';');
string InvoiceDetailTmp = arguments[0];
string RegNoTmp = arguments[1];
string ModelCodeTmp = arguments[2];
string CustomerCodeTmp = arguments[3];
string NetAmountTmp = arguments[4];
string PaidAmountTmp = arguments[5];
string BalanceAmountTmp = arguments[6];
string JobNoDetailTmp = arguments[7];
string InvoiceDateTmp = arguments[8];
// // ================== Start Date From Calendar ======================= // //
if (Convert.ToDouble(BalanceAmountTmp) <= Convert.ToDouble(LessPaymentLimit) || Math.Truncate(Convert.ToDouble(BalanceAmountTmp)) == 0)
{
TxtInvoiceNo.Text = "";
TxtCustomerCode.Text = "";
TxtModelCode.Text = "";
//ClearText(PnlSearchAdvance);
//ClearRbtn(PnlSearchAdvance);
//ClearText(PnlSearchCollection);
//ClearRbtn(PnlSearchCollection);
//ClearGridView(PnlCustomerList);
//ClearGridView(PnlInvoiceList);
ClearText(PnlInvoiceDetail);
ClearText(PnlCustomerDetail);
ClearText(PnlVehicleDetail);
ClearGridView(PnlReceiptList);
ClearGridView(PnlPendingInvoiceList);
ClearDdl(PnlPaymentModelSelection);
ClearGridView(PnlBankAccountList);
ClearText(PnlPaymentDetail);
ClearText(PnlSaveEntry);
LblInvoiceValue.Text = "0";
LblPaidAmount.Text = "0";
LblBalanceAmount.Text = "0";
LblCustomerBalance.Text = "0";
TxtInvoiceNo.Text = InvoiceDetailTmp;
TxtCustomerCode.Text = CustomerCodeTmp;
LoadReceiptList();
SwalTitle = "Information !!";
SwalShowMessage = "No Pending Balance";
SwalMessageType = "info"; // info error warning
SwalErrorMessageDisplay();
return;
}
//SwalTitle = "Information !!";
//SwalShowMessage = "No Pending Balance " + Math.Truncate( Convert.ToDouble(BalanceAmountTmp)).ToString() + " " + LessPaymentLimit;
//SwalMessageType = "info"; // info error warning
//SwalErrorMessageDisplay();
TxtInvoiceNo.Text = InvoiceDetailTmp;
TxtCustomerCode.Text = CustomerCodeTmp;
TxtModelCode.Text = ModelCodeTmp;
GetInvoiceDetail();
GetCustomerDetail();
GetModelDetail();
LoadReceiptList();
GetCustomerBalance();
}
//
protected void GetCustomerBalance()
{
MainBranchCode = int.Parse(TxtUserBranchCode.Text);
MainCompanyCode = int.Parse(TxtUserCompanyCode.Text);
CustomerBalance = 0;
// Search by code SearchParameterNumber value must be >0 and string value="NA"
SearchParameterNumber1 = int.Parse(TxtCustomerCode.Text);
SearchParameterNumber2 = MainCompanyCode;
//SearchParameterString = TxtInvoiceNo.Text.Trim();
MainClass ClassObj = new MainClass(); // Class Object
//<Class> <ObjectName>= new <ClassFileName>;
MainClass.TransactionStatusClass = ClassObj.GetCustomerBalanceClass(SearchParameterNumber1, SearchParameterNumber2); //Connection path from Class
//Define Function Return Value
//<ClassName>.<Variable>=<ClassObject>.<FunctionName()>;
TransactionStatus = MainClass.TransactionStatusClass;
CustomerBalance = MainClass.CustomerBalanceClass;
if (CustomerBalance == 0)
{
LblBalanceType.Text = "";
LblCustomerBalance.ForeColor = System.Drawing.Color.Black;
}
else
{
LblBalanceType.Text = MainClass.BalanceTypeClass;
LblCustomerBalance.ForeColor = System.Drawing.Color.Red;
}
LblCustomerBalance.Text = CustomerBalance.ToString("#,##0.00");
}
// End Customer Balance
protected void LoadReceiptList(string sortExpression = null)
{
ConnectionStringFunction();
SqlCn = new SqlConnection(ConPath);
SqlCn.Open();
MainClass.ProcNameClass = "ReceiptListByCustomer";
SearchParameterString1 = TxtInvoiceNo.Text.Trim();
SearchParameterNumber1 = int.Parse(TxtCustomerCode.Text.Trim());
MainBranchCode = int.Parse(TxtUserBranchCode.Text);
MainCompanyCode = int.Parse(TxtUserCompanyCode.Text);
try
{
SqlCm = new SqlCommand(MainClass.ProcNameClass, SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("CustomerCode", SearchParameterNumber1);
SqlCm.Parameters.AddWithValue("MainCompanyCode", MainCompanyCode);
SqlDa = new SqlDataAdapter(SqlCm);
SqlDt = new DataTable();
SqlDa.Fill(SqlDt);
if (sortExpression != null)
{
DataView dv = SqlDt.AsDataView();
this.SortDirection = this.SortDirection == "ASC" ? "DESC" : "ASC";
dv.Sort = sortExpression + " " + this.SortDirection;
GvReceiptList.DataSource = dv;
}
else
{
GvReceiptList.DataSource = SqlDt;
}
GvReceiptList.DataBind();
//TotalRowCount = GvPendingList.Rows.Count;
//TotalColCount = GvPendingList.Columns.Count;
//for (int i = 0; i <= TotalColumnCount - 1; i++)
//{
// GvStaffList.Columns[i].ItemStyle.Wrap = false;
//}
TransactionStatus = true;
}
// End Try
catch (Exception ex)
{
TransactionStatus = false;
}
// Catch
finally
{
SqlCn.Close();
}
// End Finally
}
// End Receipt List
protected void PrintReceipt(object sender, EventArgs e)
{
//// ============================== Working ==================================
//////int id = int.Parse((sender as LinkButton).CommandArgument);
////string id = (sender as LinkButton).CommandArgument;
LinkButton lnkRowSelection = (LinkButton)sender;
string[] arguments = lnkRowSelection.CommandArgument.Split(';');
string ReceiptNoTmp = arguments[0];
int BrandCodeTmp = int.Parse(arguments[1]);
Application["BrandCode"] = BrandCodeTmp;
Application["ReceiptDetail"] = ReceiptNoTmp;
Application["PrintStatus"] = "Re-Print";
//Response.Redirect("~/PrintReceipt.aspx"); // Open on same page
Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('PrintReceipt.aspx','_newtab');", true);
// ================================= End Working ======================================================
//string name = txtName.Text;
//string technology = ddlTechnology.SelectedItem.Value;
//Response.Redirect(string.Format("~/PrintReceipt.aspx?ReceiptNoTmp={0}&BrandCodeTmp={1}", ReceiptNoTmp, BrandCodeTmp));
}
//
protected void GetInvoiceDetail()
{
// Search by code SearchParameterNumber value must be >0 and string value="NA"
//SearchParameterNumber = SupplierCode;
SearchParameterString1 = TxtInvoiceNo.Text.Trim();
MainClass ClassObj = new MainClass(); // Class Object
//<Class> <ObjectName>= new <ClassFileName>;
MainClass.TransactionStatusClass = ClassObj.GetInvoiceDetailFromClass(SearchParameterString1, MainBranchCode); //Connection path from Class
//Define Function Return Value
//<ClassName>.<Variable>=<ClassObject>.<FunctionName()>;
TransactionStatus = MainClass.TransactionStatusClass;
if (TransactionStatus == true)
{
InvoiceNoDetail = MainClass.InvoiceNoDetailClass;
InvoiceDate = MainClass.InvoiceDateClass;
InvoiceStatus = MainClass.InvoiceStatusClass;
PartsAmount = MainClass.PartsAmountClass;
LabourAmount = MainClass.LabourAmountClass;
TotalAmount = MainClass.TotalAmountClass;
DiscountAmountParts = MainClass.DiscountAmountPartsClass;
DiscountAmountLabour = MainClass.DiscountAmountLabourClass;
DiscountAmount = MainClass.DiscountAmountClass;
Tax1AmountParts = MainClass.Tax1AmountPartsClass;
Tax2AmountParts = MainClass.Tax2AmountPartsClass;
Tax3AmountParts = MainClass.Tax3AmountPartsClass;
Tax1AmountService = MainClass.Tax1AmountServiceClass;
Tax2AmountService = MainClass.Tax2AmountServiceClass;
Tax3AmountService = MainClass.Tax3AmountServiceClass;
TaxAmount = MainClass.TaxAmountClass;
NetAmount = MainClass.NetAmountClass;
InvoiceCancelStatus = MainClass.InvoiceCancelStatusClass;
InvoiceTypeName = MainClass.InvoiceTypeNameClass;
InvoiceTypeCode = MainClass.InvoiceTypeCodeClass;
InvoiceCancelDate = MainClass.InvoiceCancelDateClass;
InvoiceCancelRemark = MainClass.InvoiceCancelRemarkClass;
InvoiceRemark = MainClass.InvoiceRemarkClass;
InvoicePaymentMode = MainClass.PaymentModeClass; //
PaidAmount = MainClass.PaidAmountClass;
BalanceAmount = MainClass.BalanceAmountClass;
RegNo = MainClass.RegNoClass;
JobNoDetail = MainClass.JobNoDetailClass;
TxtInvoiceDate.Text = InvoiceDate;
TxtNetAmount.Text = NetAmount.ToString("#,##0.00");
TxtPaidAmount.Text = PaidAmount.ToString("#,##0.00");
TxtBalanceAmount.Text = BalanceAmount.ToString("#,##0.00");
LblInvoiceValue.Text = NetAmount.ToString("#,##0.00");
LblPaidAmount.Text = PaidAmount.ToString("#,##0.00");
LblBalanceAmount.Text = BalanceAmount.ToString("#,##0.00");
TxtRegNo.Text = RegNo;
TxtJobNo.Text = JobNoDetail;
GetVehicleDetail();
LoadInvoiceList();
}
}
//End Get Invoice Detail
protected void GetCustomerDetail()
{
SearchParameterNumber1 = int.Parse(TxtCustomerCode.Text);
// Start Get Customer Detail From Class
MainClass ClassObjCustomerDetail = new MainClass();
MainClass.TransactionStatusClass = ClassObjCustomerDetail.CustomerDetailFromClass(SearchParameterNumber1);
TransactionStatus = MainClass.TransactionStatusClass;
CustomerName = MainClass.CustomerNameClass;
CustomerTitle = MainClass.CustomerTitleClass;
CustomerIdentity = MainClass.CustomerIdentityClass;
CustomerContactPersonName = MainClass.CustomerContactPersonNameClass;
CustomerContactPersonDesignation = MainClass.CustomerContactPersonNameClass;
CustomerContactPersonPhoneNo = MainClass.CustomerContactPersonPhoneNoClass;
CustomerFirstName = MainClass.CustomerFirstNameClass;
CustomerMiddleName = MainClass.CustomerMiddleNameClass;
CustomerLastName = MainClass.CustomerLastNameClass;
CustomerType = MainClass.CustomerTypeClass;
CustomerGroup = MainClass.CustomerGroupClass;
CustomerGender = MainClass.CustomerGenderClass;
CustomerAddress1 = MainClass.CustomerAddress1Class;
CustomerAddress2 = MainClass.CustomerAddress2Class;
CustomerCityCode = MainClass.CustomerCityCodeClass;
CustomerPBNo = MainClass.CustomerPBNoClass;
CustomerStateCode = MainClass.CustomerStateCodeClass;
CustomerPhoneNo = MainClass.CustomerPhoneNoClass;
CustomerMobileNo = MainClass.CustomerMobileNoClass;
CustomerEmailId = MainClass.CustomerEmailIdClass;
CustomerActiveStatus = MainClass.CustomerActiveStatusClass;
CustomerCreditLimitStatus = MainClass.CustomerCreditLimitStatusClass;
CustomerTaxCategory = MainClass.CustomerTaxCategoryClass;
CustomerTaxID = MainClass.CustomerTaxIDClass;
CustomerVatNo = MainClass.CustomerVatNoClass;
CustomerTinNo = MainClass.CustomerTinNoClass;
CustomerTaxCategory = MainClass.CustomerTaxCategoryClass;
if (CustomerTitle == "NA")
{
TxtCustomerName.Text = CustomerName;
}
else
{
TxtCustomerName.Text = CustomerTitle + CustomerName;
}
}
// End Display Customer Detail
protected void GetModelDetail()
{
SearchParameterNumber1 = int.Parse(TxtModelCode.Text);
MainClass ClassObjModelDetail = new MainClass();
MainClass.TransactionStatusClass = ClassObjModelDetail.GetModelDetailFromClass(SearchParameterNumber1);
TransactionStatus = MainClass.TransactionStatusClass;
ModelName = MainClass.ModelNameClass;
Transmission = MainClass.TransmissionClass;
ModelGroupName = MainClass.ModelGroupNameClass;
BrandName = MainClass.BrandNameClass;
ModelGroupCode = MainClass.ModelGroupCodeClass;
BrandCode = MainClass.BrandCodeClass;
//EngineCapacityClass = Convert.ToDouble( MainClass.EngineCapacityClass;);
Specs = MainClass.SpecsClass; ;
ModelRetailPrice = MainClass.ModelRetailPriceClass;
ModelSalesPrice = MainClass.ModelSalesPriceClass;
ModelManagementPrice = MainClass.ModelManagementPriceClass;
ModelCurrency = MainClass.ModelCurrencyClass;
TxtBrandCode.Text = BrandCode.ToString();
TxtBrandName.Text = BrandName;
TxtModelName.Text = ModelName + " - " + Transmission;
TxtRegNo.Text = RegNo;
TxtChassisNo.Text = ChassisNo;
//TxtTransmission.Text = Transmission;
//TxtBrandCode.Text = BrandCode.ToString();
//TxtBrandName.Text = BrandName;
//TxtBasePrice.Text = ModelRetailPrice.ToString("#,##0.00");
//TxtCurrencyModel.Text = ModelCurrency;
//TxtSpecs.Text = Specs;
//TxtRetailPrice.Text = ModelRetailPrice.ToString("#,##0.00");
//TxtUnitPrice.Text = ModelRetailPrice.ToString("#,##0.00");
}
// End Model Detail
protected void LoadUnInvoicedList()
{
GvUnInvoicedList.DataSource = null;
GvUnInvoicedList.DataBind();
MainBranchCode = int.Parse(TxtUserBranchCode.Text);
MainCompanyCode = int.Parse(TxtUserCompanyCode.Text);
ConnectionStringFunction();
SqlCn = new SqlConnection(ConPath);
SqlCn.Open();
MainClass.ProcNameClass = "PendingInvoiceForRepairOrder";
try
{
SqlCm = new SqlCommand(MainClass.ProcNameClass, SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("JobOrderDetail", TxtJobNo.Text.Trim());
SqlCm.Parameters.AddWithValue("BrandCode", int.Parse(TxtBrandCode.Text));
SqlDa = new SqlDataAdapter(SqlCm);
SqlDt = new DataTable();
SqlDa.Fill(SqlDt);
GvUnInvoicedList.DataSource = SqlDt;
GvUnInvoicedList.DataBind();
TransactionStatus = true;
}
// End Try
catch (Exception ex)
{
TransactionStatus = false;
}
// Catch
finally
{
SqlCn.Close();
}
// End Finally
}
// End Load UnInvoiced List
protected void GetVehicleDetail()
{
SearchParameterString1 = RegNo;
SearchMode = "REGNO";
MainClass ClassObjModelDetail = new MainClass();
MainClass.TransactionStatusClass = ClassObjModelDetail.GetVehcileDetailFromClass(SearchMode, SearchParameterString1);
TransactionStatus = MainClass.TransactionStatusClass;
BrandCode = MainClass.BrandCodeClass;
BrandName = MainClass.BrandNameClass;
BrandNickName = MainClass.BrandNickNameClass;
ModelGroupCode = MainClass.ModelGroupCodeClass;
ModelGroupName = MainClass.ModelGroupNameClass;
ModelCode = MainClass.ModelCodeClass;
ModelName = MainClass.ModelNameClass;
ModelYear = MainClass.ModelYearClass;
ColourOEMCode = MainClass.ColourOEMCodeClass;
ColourCode = MainClass.ColourCodeClass;
ColourName = MainClass.ColourNameClass;
RegNo = MainClass.RegNoClass;
ChassisNo = MainClass.ChassisNoClass;
EngineNo = MainClass.EngineNoClass;
Transmission = MainClass.TransmissionClass;
SaleType = MainClass.SaleTypeClass;
SoldDate = MainClass.SoldDateClass;
DeliveryNoteNo = MainClass.DeliveryNoteNoClass;
TxtChassisNo.Text = ChassisNo;
}
// End Vehcile Detail
protected void LoadBankAccountList(string sortExpression = null)
{
GVBankAccountList.DataSource = null;
GVBankAccountList.DataBind();
MainBranchCode = int.Parse(TxtUserBranchCode.Text);
MainCompanyCode = int.Parse(TxtUserCompanyCode.Text);
ConnectionStringFunction();
SqlCn = new SqlConnection(ConPath);
SqlCn.Open();
MainClass.ProcNameClass = "BankAccountListPro";
try
{
SqlCm = new SqlCommand(MainClass.ProcNameClass, SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("CompanyCode", MainCompanyCode);
SqlDa = new SqlDataAdapter(SqlCm);
SqlDt = new DataTable();
SqlDa.Fill(SqlDt);
if (sortExpression != null)
{
DataView dv = SqlDt.AsDataView();
this.SortDirection = this.SortDirection == "ASC" ? "DESC" : "ASC";
dv.Sort = sortExpression + " " + this.SortDirection;
GVBankAccountList.DataSource = dv;
}
else
{
GVBankAccountList.DataSource = SqlDt;
}
GVBankAccountList.DataBind();
TransactionStatus = true;
}
// End Try
catch (Exception ex)
{
TransactionStatus = false;
}
// Catch
finally
{
SqlCn.Close();
}
// End Finally
}
// End Load Bank Account No
protected void GVBankAccountList_RowDataBound(object sender, GridViewRowEventArgs e)
{
var FindWord = "USD";
if (e.Row.RowType == DataControlRowType.DataRow)
{
foreach (TableCell cell in e.Row.Cells)
{
string TextFromGrid = e.Row.Cells[1].Text;
if (TextFromGrid.Contains(FindWord))
{
cell.ForeColor = Color.Blue;
cell.BackColor = Color.LightYellow;
cell.Font.Bold = true;
}
else
{
cell.ForeColor = Color.Black;
cell.BackColor = Color.White;
cell.Font.Bold = false;
}
}
}
}
// End Bank Account List
protected void ViewAccountDetail(object sender, EventArgs e)
{
////int id = int.Parse((sender as LinkButton).CommandArgument);
//string id = (sender as LinkButton).CommandArgument;
//CommandArgument='<%# Eval("BankAccountName") + ";" + Eval("BankAccountNo") + ";" + Eval("BankName") + ";" +
//Eval("BankCode") + ";" + Eval("BankChargeCHQ") + ";" + Eval("BankChargePOS") %>'></asp:LinkButton>
//ClearText(PnlPaymentDetail);
LinkButton lnkRowSelection = (LinkButton)sender;
string[] arguments = lnkRowSelection.CommandArgument.Split(';');
string BankAccountNameTmp = arguments[0];
string BankAccountNoTmp = arguments[1];
string BankNameTmp = arguments[2];
string BankCodeTmp = arguments[3];
string BankChargeCHQTmp = arguments[4];
string BankChargePOSTmp = arguments[5];
double BankChargeChqTmp2 = Convert.ToDouble(BankChargeCHQTmp);
double BankChargePOSTmp2 = Convert.ToDouble(BankChargePOSTmp);
if (BankChargeChqTmp2 > BankChargePOSTmp2)
{
TxtBankPosCharges.Text = BankChargeChqTmp2.ToString("#,##0.00");
}
else
{
TxtBankPosCharges.Text = BankChargePOSTmp2.ToString("#,##0.00");
}
TxtBankAccountNo.Text = BankAccountNoTmp;
TxtBankName.Text = BankNameTmp;
TxtBankCode.Text = BankCodeTmp;
}
protected void DdlPaymentMode_SelectedIndexChanged(object sender, EventArgs e)
{
ReceiptPaymentModeShort = "";
LblPaymentMode.Text = "";
if (DdlPaymentMode.SelectedIndex <= 0)
{
LblPaymentMode.Text = "Payment Mode : NA";
ReceiptPaymentModeShort = "NA";
}
else
{
ReceiptPaymentModeShort = "";
ClearText(PnlPaymentDetail);
LblPaymentMode.Text = "Payment Mode : " + DdlPaymentMode.Text;
TxtInstrumentNo.Text = DdlPaymentMode.SelectedValue;
TxtInstrumentBank.Text = DdlPaymentMode.SelectedValue;
TxtInstrumentDate.Text = "01/01/1900";
if (DdlPaymentMode.SelectedValue == "CA")
{
GVBankAccountList.DataSource = null;
GVBankAccountList.DataBind();
TxtBankAccountNo.Text = "NA";
TxtBankName.Text = "NA";
TxtBankCode.Text = "NA";
TxtBankPosCharges.Text = "0.00";
TxtInstrumentNo.Enabled = false;
TxtInstrumentBank.Enabled = false;
TxtInstrumentDate.Enabled = true;
TxtInstrumentNo.Text = "NA";
TxtInstrumentBank.Text = "NA";
TxtInstrumentDate.Text = "01/01/1900";
}
else if (DdlPaymentMode.SelectedValue == "CH" || DdlPaymentMode.SelectedValue == "DD")
{
TxtInstrumentNo.Enabled = true;
TxtInstrumentBank.Enabled = true;
TxtInstrumentDate.Enabled = true;
TxtInstrumentNo.Text = "";
TxtInstrumentBank.Text = "";
LoadBankAccountList();
}
else if (DdlPaymentMode.SelectedValue == "PO")
{
GVBankAccountList.DataSource = null;
GVBankAccountList.DataBind();
TxtBankAccountNo.Text = "NA";
TxtBankName.Text = "NA";
TxtBankCode.Text = "NA";
TxtBankPosCharges.Text = "0.00";
TxtInstrumentNo.Enabled = false;
TxtInstrumentBank.Enabled = false;
TxtInstrumentDate.Enabled = true;
TxtInstrumentNo.Text = "NA";
TxtInstrumentBank.Text = "NA";
TxtInstrumentDate.Text = "01/01/1900";
LoadBankAccountList();
}
else if (DdlPaymentMode.SelectedValue == "TR")
{
GVBankAccountList.DataSource = null;
GVBankAccountList.DataBind();
TxtBankAccountNo.Text = "NA";
TxtBankName.Text = "NA";
TxtBankCode.Text = "NA";
TxtBankPosCharges.Text = "0.00";
TxtInstrumentNo.Enabled = false;
TxtInstrumentBank.Enabled = false;
TxtInstrumentDate.Enabled = true;
TxtInstrumentNo.Text = "NA";
TxtInstrumentBank.Text = "NA";
TxtInstrumentDate.Text = "01/01/1900";
LoadBankAccountList();
}
ReceiptPaymentModeShort = DdlPaymentMode.SelectedValue;
}
}
//
protected void TxtReceiptAmount_TextChanged(object sender, EventArgs e)
{
if (TxtReceiptAmount.Text == "")
{
TxtReceiptAmount.Text = "0";
}
TxtAmountInLc.Text = (Convert.ToDouble(TxtReceiptAmount.Text) * Convert.ToDouble(TxtExchnageRate.Text)).ToString("#,##0.00");
}
//
protected void BtnSave_Click(object sender, EventArgs e)
{
if (TxtReceiptAmount.Text == "")
{
TxtReceiptAmount.Text = "0";
}
TxtAmountInLc.Text = (Convert.ToDouble(TxtReceiptAmount.Text) * Convert.ToDouble(TxtExchnageRate.Text)).ToString("#,##0.00");
ReceiptAmountInLc = Convert.ToDouble(TxtAmountInLc.Text);
if (DdlCurrency.SelectedIndex <= 0)
{
SwalTitle = "Warning !!";
SwalShowMessage = "Select Curency ! ";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (DdlInvoiceCategory.SelectedIndex <= 0)
{
SwalTitle = "Warning !!";
SwalShowMessage = "Select Invoice Category ! ";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (Convert.ToDouble(TxtExchnageRate.Text) == 0 || TxtExchnageRate.Text == "")
{
SwalTitle = "Warning !!";
SwalShowMessage = "Check Exchange Rate";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (TxtInvoiceNo.Text.Trim() == "")
{
SwalTitle = "Warning !!";
SwalShowMessage = "Select Invoice";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (int.Parse(TxtCustomerCode.Text) <= 0 || TxtCustomerCode.Text == "")
{
SwalTitle = "Warning !!";
SwalShowMessage = "No Customer Information";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (InvoiceCategory == "WORKSHOP")
{
if (PaymentCategory == "COLLECTION")
{
// Collection
if (int.Parse(TxtBrandCode.Text) <= 0 || TxtBrandCode.Text == "")
{
SwalTitle = "Warning !!";
SwalShowMessage = "No Brand Information";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (int.Parse(TxtModelCode.Text) <= 0 || TxtModelCode.Text == "")
{
SwalTitle = "Warning !!";
SwalShowMessage = "No Model Information";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (TxtSearchValueCollection.Text == "" || TxtSearchValueCollection.Text.Length < 2)
{
SwalTitle = "Warning !!";
SwalShowMessage = "Provide Search Value";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (Convert.ToDouble(TxtBalanceAmount.Text) <= 0 || TxtBalanceAmount.Text == "")
{
SwalTitle = "Warning !!";
SwalShowMessage = "No Invoice Banlance";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
}
else
{
// Advance
if (TxtSearchValueAdvance.Text == "" || TxtSearchValueAdvance.Text.Length < 2)
{
SwalTitle = "Warning !!";
SwalShowMessage = "Provide Search Value";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
}
// End Payment Category
}
else
{
if (PaymentCategory == "COLLECTION")
{
// Collection
if (TxtBrandCode.Text == "")
{
SwalTitle = "Warning !!";
SwalShowMessage = "No Brand Information";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (TxtModelCode.Text == "")
{
SwalTitle = "Warning !!";
SwalShowMessage = "No Model Information";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (TxtSearchValueCollection.Text == "" || TxtSearchValueCollection.Text.Length < 2)
{
SwalTitle = "Warning !!";
SwalShowMessage = "Provide Search Value";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (Convert.ToDouble(TxtBalanceAmount.Text) <= 0 || TxtBalanceAmount.Text == "")
{
SwalTitle = "Warning !!";
SwalShowMessage = "No Invoice Banlance";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
}
else
{
// Advance
if (TxtSearchValueAdvance.Text == "" || TxtSearchValueAdvance.Text.Length < 2)
{
SwalTitle = "Warning !!";
SwalShowMessage = "Provide Search Value";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
}
// End Payment Category
}
// End Invoice Category
if (DdlPaymentMode.SelectedIndex <= 0)
{
SwalTitle = "Warning !!";
SwalShowMessage = "Select Payment Mode ! ";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (GvUnInvoicedList.Rows.Count > 0)
{
SwalTitle = "Warning !!";
SwalShowMessage = "Un-Invoiced Record Found. Need to process invoice ";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (DdlPaymentMode.Text == "CASH")
{
ReceiptPaymentMode = "CASH";
}
else
{
//ReceiptPaymentMode = DdlPaymentMode.Text.Trim();
ReceiptPaymentMode = "BANK";
}
if (ReceiptPaymentMode != "CASH")
{
if (TxtBankAccountNo.Text.Trim() == "")
{
SwalTitle = "Warning !!";
SwalShowMessage = "Provide Account No ";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
}
if (Convert.ToDouble(TxtReceiptAmount.Text) == 0 || TxtReceiptAmount.Text == "")
{
SwalTitle = "Warning !!";
SwalShowMessage = "Provide Receipt Amount";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (TxtNarration.Text == "" || TxtNarration.Text.Length < 5)
{
SwalTitle = "Warning !!";
SwalShowMessage = "Provide narration minimum 5 characters";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
TransactionStatus = false;
SaveReceipt();
if (TransactionStatus == false)
{
if (SwalErrorServerSide.Length < 30)
{
//SwalTitle = "Duplicate receipt message";
//SwalShowMessage = "Error";
SwalShowMessage = SwalErrorServerSide;
SwalMessageType = "error";
SwalErrorMessageDisplay();
return;
}
else
{
//SwalTitle = "Failed [Check Error Table]";
//SwalShowMessage = "Error";
SwalShowMessage = SwalErrorServerSide.Substring(0, 40);
SwalMessageType = "error";
SwalErrorMessageDisplay();
return;
}
}
else
{
Application["BrandCode"] = int.Parse(TxtBrandCode.Text);
Application["ReceiptDetail"] = TmpReceiptNo;
Application["PrintStatus"] = "-";
ClearText(PnlCustomerDetail);
ClearText(PnlInvoiceDetail);
ClearText(PnlReceiptList);
ClearText(PnlPaymentDetail);
ClearText(PnlVehicleDetail);
ClearGridView(PnlInvoiceList);
ClearGridView(PnlBankAccountList);
ClearGridView(PnlInvoiceList);
ClearGridView(PnlPaymentModelSelection);
ClearDdl(PnlReceiptList);
//UserDetail();
//Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('PrintReceipt.aspx','_newtab');", true);
//SwalTitle = "Success";
SwalShowMessage = SwalErrorServerSide;
SwalMessageType = "success"; // info error warning
SwalErrorMessageDisplay();
Response.Redirect("~/PrintReceipt.aspx"); // Open on same page
//Response.Redirect(Request.Url.AbsoluteUri);
////Application["BrandCode"] = BrandCode.ToString();
//Application["ReceiptDetail"] = ReceiptNoGenerated;
//Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('ReceiptPrint.aspx','_newtab');", true);
}
// end Transaction success
//string confirmValue = HfResponseOne.Value;
//if (confirmValue == "No")
//{
// SwalTitle = "Warning !!";
// SwalShowMessage = "Process Has Been Cancelled By User'";
// SwalMessageType = "warning"; // info error warning
// SwalErrorMessageDisplay();
// return;
//}
//else // Yes Condition
//{
//}
//// End Yes
}
// End Btn Save Entry
protected void SaveReceipt()
{
GetSqlServerDate();
ConnectionStringFunction();
SqlCn = new SqlConnection(ConPath);
SqlCn.Open();
MainBranchCode = int.Parse(TxtUserBranchCode.Text);
MainCompanyCode = int.Parse(TxtUserCompanyCode.Text);
TodayDate = MainClass.SqlServerDate.ToString("MM/dd/yyyy");
DateTime DateTimeTodayDate = DateTime.ParseExact(TodayDate, "MM/dd/yyyy", null); // textbox show be read only =false
DateTimeTodayDate = Convert.ToDateTime(DateTimeTodayDate, System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat);
JobNoDetail = TxtJobNo.Text.Trim().ToUpper();
InvoiceNoDetail = TxtInvoiceNo.Text.Trim().ToUpper();
ChassisNo = TxtChassisNo.Text.Trim().ToUpper();
RegNo = TxtRegNo.Text.Trim().ToUpper();
DepartmentCode = 20;
TransactionDate = DateTimeTodayDate.ToString("MM/dd/yyyy");
TransactionTime = MainClass.TodateTimeClass;
ReceiptType = PaymentCategory;
ReceiptPaymentModeShort = DdlPaymentMode.SelectedValue; // CA,CH.PO.TR
ReceiptPaymentMode = DdlPaymentMode.SelectedItem.Text;
Narration = TxtNarration.Text.Trim().ToUpper();
ReceiptAmount = Convert.ToDouble(TxtReceiptAmount.Text);
ReceiptAllocatedAmount = Convert.ToDouble(TxtReceiptAmount.Text);
InvoiceAmount = Convert.ToDouble(TxtNetAmount.Text);
if (ReceiptAmount <= InvoiceAmount)
{
ReceiptBalanceAmount = 0;
}
else
{
ReceiptBalanceAmount = ReceiptAmount - InvoiceAmount;
}
UserIdandName = TxtUserId.Text.Trim().ToUpper() + "-" + TxtUserName.Text.Trim().ToUpper();
BankCode = TxtBankCode.Text.ToUpper();
BankName = TxtBankName.Text.ToUpper();
BankAccountNo = TxtBankAccountNo.Text.Trim().ToUpper();
BankDetailsNarration = "NO DETAIL"; //===========================================================
CustomerCode = int.Parse(TxtCustomerCode.Text);
CustomerName = TxtCustomerName.Text.ToUpper();
BrandCode = int.Parse(TxtBrandCode.Text);
CurrencyName = DdlCurrency.Text.Trim().ToUpper();
MainBranchCode = int.Parse(TxtUserBranchCode.Text);
MainCompanyCode = int.Parse(TxtUserCompanyCode.Text);
CashierId = int.Parse(TxtUserId.Text);
CashierName = TxtUserName.Text.Trim().ToUpper();
ExchangeRate = Convert.ToDouble(TxtExchnageRate.Text);
ReceiptAmountInLc = Convert.ToDouble(TxtAmountInLc.Text);
string NewEntry = "Entry By : " +
TxtUserId.Text.Trim() + "-" +
TxtUserName.Text.Trim() + " " + DateTime.Now.Date.ToString("dd-MM-yyyy") + " " + TransactionTime;
EntryBy = NewEntry;
//InvoiceAmount = Convert.ToDouble(TxtNetAmount.Text);
VoucherUniqueId = Guid.NewGuid().ToString();
MainLocation = MainClass.MainLocationClass;
InvoiceReceivableAmount = Convert.ToDouble(LblBalanceAmount.Text);
ReceiptPreviousBalance = Convert.ToDouble(LblPaidAmount.Text);
double PaymentDiff = 0;
PaymentDiff = Convert.ToDouble(TxtReceiptAmount.Text) - Convert.ToDouble(TxtBalanceAmount.Text);
if (PaymentDiff < 0)
{
PaymentDiff = Math.Abs(PaymentDiff);
if (PaymentDiff > Convert.ToDouble(LessPaymentLimit))
{
GatepassApprovedStatus = "N";
}
else
{
GatepassApprovedStatus = "Y";
}
}
else
{
GatepassApprovedStatus = "Y";
}
if (PaymentCategory == "ADVANCE")
{
ReceiptAllocatedAmount = 0;
GatepassApprovedStatus = "N";
}
else
{
}
MainBranchNick = MainClass.MainBranchNickClass;
ReceiptNewBalance = Convert.ToDouble(TxtBalanceAmount.Text);
DateTime DateTimeInstrumentDate = DateTime.ParseExact(TxtInstrumentDate.Text, "MM/dd/yyyy", null); // textbox show be read only =false
DateTimeInstrumentDate = Convert.ToDateTime(DateTimeInstrumentDate, System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat);
//"hi-IN" is culture information about India. You can change as per culture like French, German, etc.
string message = string.Empty;
TmpReceiptNo = string.Empty;
GetLastNoFromClass();
TmpReceiptNo = MainBranchCode.ToString() + "-CRC-" + LastNo.ToString("0000000", CultureInfo.InvariantCulture);
try
{
SqlCommand SqlCm = new SqlCommand("SaveReceipt");
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Connection = SqlCn;
SqlCm.Parameters.AddWithValue("JobCardDetails", JobNoDetail);
SqlCm.Parameters.AddWithValue("InvoiceDetails", InvoiceNoDetail);
SqlCm.Parameters.AddWithValue("ChassisNo", ChassisNo);
SqlCm.Parameters.AddWithValue("RegNo", RegNo);
SqlCm.Parameters.AddWithValue("DepartmentCode", DepartmentCode);
SqlCm.Parameters.AddWithValue("TransactionDate", TransactionDate);
SqlCm.Parameters.AddWithValue("TransactionTime", TransactionTime);
SqlCm.Parameters.AddWithValue("ReceiptType", ReceiptType);
SqlCm.Parameters.AddWithValue("ReceiptPaymentModeShort", ReceiptPaymentModeShort);
SqlCm.Parameters.AddWithValue("ReceiptPaymentMode", ReceiptPaymentMode);
SqlCm.Parameters.AddWithValue("Narration", Narration);
SqlCm.Parameters.AddWithValue("ReceiptAmount", ReceiptAmount);
SqlCm.Parameters.AddWithValue("ReceiptAllocatedAmount", ReceiptAllocatedAmount);
SqlCm.Parameters.AddWithValue("ReceiptBalanceAmount", ReceiptBalanceAmount);
SqlCm.Parameters.AddWithValue("UserIdandName", UserIdandName);
SqlCm.Parameters.AddWithValue("BankCode", BankCode);
SqlCm.Parameters.AddWithValue("BankName", BankName);
SqlCm.Parameters.AddWithValue("BankAccountNo", BankAccountNo);
SqlCm.Parameters.AddWithValue("BankDetails", BankDetailsNarration);
SqlCm.Parameters.AddWithValue("CustomerCode", CustomerCode);
SqlCm.Parameters.AddWithValue("CustomerName", CustomerName);
SqlCm.Parameters.AddWithValue("BrandCode", BrandCode);
SqlCm.Parameters.AddWithValue("CurrencyName", CurrencyName);
SqlCm.Parameters.AddWithValue("MainBranchCode", MainBranchCode);
SqlCm.Parameters.AddWithValue("MainCompanyCode", MainCompanyCode);
SqlCm.Parameters.AddWithValue("CashierId", CashierId);
SqlCm.Parameters.AddWithValue("CashierName", CashierName);
SqlCm.Parameters.AddWithValue("ExchangeRate", ExchangeRate);
SqlCm.Parameters.AddWithValue("ReceiptAmountInLc", ReceiptAmountInLc);
SqlCm.Parameters.AddWithValue("EntryBy", EntryBy);
SqlCm.Parameters.AddWithValue("InvoiceAmount", InvoiceAmount);
SqlCm.Parameters.AddWithValue("VoucherUniqueId", VoucherUniqueId);
SqlCm.Parameters.AddWithValue("MainLocation", MainLocation);
SqlCm.Parameters.AddWithValue("InvoiceReceivableAmount", InvoiceReceivableAmount);
SqlCm.Parameters.AddWithValue("ReceiptPreviousBalance", ReceiptPreviousBalance);
SqlCm.Parameters.AddWithValue("GatepassApprovedStatus", GatepassApprovedStatus);
SqlCm.Parameters.AddWithValue("MainBranchNick", MainBranchNick);
SqlCm.Parameters.AddWithValue("ReceiptNewBalance", ReceiptNewBalance);
SqlCm.Parameters.AddWithValue("InstrumentNo", TxtInstrumentNo.Text.Trim().ToUpper());
SqlCm.Parameters.AddWithValue("InstrumentBank", TxtInstrumentBank.Text.Trim().ToUpper());
SqlCm.Parameters.AddWithValue("InstrumentDate", DateTimeInstrumentDate.ToString("MM/dd/yyyy"));
SqlCm.Parameters.AddWithValue("ReceiptDetails", TmpReceiptNo);
SqlCm.Parameters.AddWithValue("LastReceiptNo", LastNo);
SqlCm.Parameters.Add("@ERROR", SqlDbType.Char, 500);
SqlCm.Parameters["@ERROR"].Direction = ParameterDirection.Output;
SqlCm.Parameters.Add("@ERRORDOCUMENT", SqlDbType.Char, 500);
SqlCm.Parameters["@ERRORDOCUMENT"].Direction = ParameterDirection.Output;
SqlCm.ExecuteNonQuery();
message = (string)SqlCm.Parameters["@ERROR"].Value;
TmpReceiptNo = (string)SqlCm.Parameters["@ERRORDOCUMENT"].Value;
ReceiptNoGenerated = TmpReceiptNo;
if (message.Substring(0, 2) == "OK")
{
SwalTitle = "Transaction Successful";
SwalErrorServerSide = "Receipt No :" + TmpReceiptNo;
TransactionStatus = true;
}
else
{
if (message.Substring(0, 9) == "Duplicate")
{
SwalTitle = "Transaction Failed !";
SwalErrorServerSide = "Duplicate No : " + TmpReceiptNo;
TransactionStatus = false;
}
else
{
SwalTitle = "Transaction failed :";
SwalErrorServerSide = message;
TransactionStatus = false;
}
}
}
// End Try
catch (Exception ex)
{
TransactionStatus = false;
SwalErrorServerSide = ex.Message.ToString();
}
// Catch
finally
{
SqlCn.Close();
}
// End Finally
}
// end save receipt
protected void GetLastNoFromClass()
{
MainClass.SqlQryClass = "SELECT MAX(ReceiptSrNo) AS LastNo FROM ReceiptDetails where MainBranchCode='" + TxtUserBranchCode.Text.Trim() + "' ";
MainClass ClassOject = new MainClass(); // Create Class Object
MainClass.LastNoClass = ClassOject.GetLastEntryNoClass(); // Pass Variable into class function
LastNo = MainClass.LastNoClass; // Define Class variable Value into Local Variable
if (LastNo == 0)
{
LastNo = 100;
}
//LastNo = LastNo + 1;
}
// End get last no from class
protected void BtnSearchAdvance_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(1000);
LblInvoiceValue.Text = "0";
LblPaidAmount.Text = "0";
LblBalanceAmount.Text = "0";
LblCustomerBalance.Text = "0";
LblPaymentMode.Text = "Payment Mode : NA";
PnlSearchAdvance.Visible = true;
PnlSearchCollection.Visible = false;
PnlCustomerList.Visible = true;
PnlInvoiceList.Visible = false;
PnlInvoiceDetail.Visible = true;
PnlCustomerDetail.Visible = true;
PnlVehicleDetail.Visible = true;
PnlReceiptList.Visible = true;
PnlPendingInvoiceList.Visible = true;
PnlPaymentModelSelection.Visible = true;
PnlBankAccountList.Visible = true;
PnlPaymentDetail.Visible = true;
PnlSaveEntry.Visible = true;
//ClearText(PnlSearchAdvance);
//ClearRbtn(PnlSearchAdvance);
//ClearText(PnlSearchCollection);
//ClearRbtn(PnlSearchCollection);
ClearGridView(PnlCustomerList);
ClearGridView(PnlInvoiceList);
ClearText(PnlInvoiceDetail);
ClearText(PnlCustomerDetail);
ClearText(PnlVehicleDetail);
ClearGridView(PnlReceiptList);
ClearGridView(PnlPendingInvoiceList);
ClearDdl(PnlPaymentModelSelection);
ClearGridView(PnlBankAccountList);
ClearText(PnlPaymentDetail);
ClearText(PnlSaveEntry);
if (DdlCurrency.SelectedIndex <= 0)
{
SwalTitle = "Warning !!";
SwalShowMessage = "Select Currency ";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (Convert.ToDouble(TxtExchnageRate.Text) == 0)
{
SwalTitle = "Information !!";
SwalShowMessage = "Exchange Rate Required !!";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (DdlInvoiceCategory.SelectedIndex <= 0)
{
SwalTitle = "Warning !!";
SwalShowMessage = "Select Invoice Catagory";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (Convert.ToDouble(TxtExchnageRate.Text) == 0 || TxtExchnageRate.Text == "")
{
SwalTitle = "Warning !!";
SwalShowMessage = "Check Exchange Rate";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (RbtnCustomerAdvance.Checked == false && RbtnVehicleAdvance.Checked == false)
{
SwalTitle = "Warning !!";
SwalShowMessage = "Select Search Option";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (RbtnCustomerAdvance.Checked == true)
{
SearchModeOption = "CUSTOMER";
}
if (RbtnVehicleAdvance.Checked == true)
{
SearchModeOption = "REGNO";
}
if (TxtSearchValueAdvance.Text == "" || TxtSearchValueAdvance.Text.Length < 2)
{
SwalTitle = "Warning !!";
SwalShowMessage = "Provide Search Value";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
InvoiceCategory = DdlInvoiceCategory.Text;
LoadInvoiceList();
}
// Btn Search advance
protected void ViewCustomerDetail(object sender, EventArgs e)
{
////int id = int.Parse((sender as LinkButton).CommandArgument);
//string id = (sender as LinkButton).CommandArgument;
LinkButton lnkRowSelection = (LinkButton)sender;
string[] arguments = lnkRowSelection.CommandArgument.Split(';');
string CustomerCodeTmp = arguments[0];
string BrandCodeTmp = arguments[1];
string ModelCodeTmp = arguments[2];
string BrandNameTmp = arguments[3];
string ModelNameTmp = arguments[4];
string RegNoTmp = arguments[5];
string ChassisTmp = arguments[6];
LblInvoiceValue.Text = "0";
LblPaidAmount.Text = "0";
LblBalanceAmount.Text = "0";
LblCustomerBalance.Text = "0";
TxtCustomerCode.Text = CustomerCodeTmp;
TxtJobNo.Text = "NA";
TxtInvoiceNo.Text = "NA";
TxtInvoiceDate.Text = "NA";
TxtNetAmount.Text = "0";
TxtPaidAmount.Text = "0";
TxtBalanceAmount.Text = "0";
TxtRegNo.Text = RegNoTmp;
TxtBrandCode.Text = BrandCodeTmp;
TxtModelCode.Text = ModelCodeTmp;
TxtBrandName.Text = BrandNameTmp;
TxtModelName.Text = ModelNameTmp;
TxtChassisNo.Text = ChassisTmp;
GetCustomerDetail();
LoadReceiptList();
GetCustomerBalance();
}
// End View Customer Detail
protected void BtnPaymentList_Click(object sender, EventArgs e)
{
if (TxtInvoiceNo.Text == "")
{
SwalTitle = "Warning !!";
SwalShowMessage = "Select Invoice From Invoice List";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
if (TxtCustomerCode.Text == "")
{
SwalTitle = "Warning !!";
SwalShowMessage = "Select Invoice From Invoice List";
SwalMessageType = "warning"; // info error warning
SwalErrorMessageDisplay();
return;
}
}
///
}
// End Class