private string BarCode(SqlTransaction tran) { string BCODE; string result = string.Empty; do { BCODE = Parking.PID.ToString() + (Parking.InDate.Month + Parking.InDate.Day + Parking.InDate.Year).ToString(); BCODE = (GParse.ToLong(BCODE) * new Random().Next(99)).ToString(); if (BCODE.Length > 14) { for (int i = 0; i < BCODE.Length / 2; i++) { result += BCODE.Substring(i, 1); } } else { result = BCODE; } if (result.Length > 7) { result = result.Substring(0, 7); } }while (tran.Connection.ExecuteScalar <int>("SELECT COUNT(*) FROM ParkingInDetails WHERE Barcode = @Barcode AND InDate > @InDate", new { Barcode = result, InDate = Parking.InDate.Subtract(new TimeSpan(365, 0, 0, 0, 0)).ToString("MM/dd/yyyy") }, transaction: tran) > 0); return(result); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value == DBNull.Value) { return(string.Empty); } else if (value.GetType() == typeof(decimal) || value.GetType() == typeof(double)) { if (GParse.ToDecimal(value) == 0) { return(string.Empty); } else { return(GParse.ToDecimal(value).ToString("#0.00")); } } else if (value.GetType() == typeof(long) && (long)value == 0) { return(string.Empty); } else { return(value.ToString()); } }
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (targetType == typeof(Int32)) { return(GParse.ToInteger(value.ToString())); } return(GParse.ToDecimal(value.ToString())); }
private void ExecuteGridDoubleClickEvent(object obj) { var RD = GParse.CopyPropertyValues(selectedReqDetails, new Requisition_Detail()) as Requisition_Detail; SelectedItemMcode = RD.Mcode; Requisition_DetailObj.Unit = RD.Unit; Requisition_DetailObj.Quantity = RD.Quantity; RequisitionObj.Requisition_Details.Remove(selectedReqDetails); }
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { double Total = 0; foreach (var val in values) { Total += GParse.ToDouble(val); } return(Total); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var result = GParse.ToDecimal(value); if (result == 0) { return("0.00"); } return((result > 0) ? result.ToString("#0.00") + " Dr" : (-result).ToString("#0.00") + " Cr"); }
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value.Equals(string.Empty)) { return(0); } else { return(GParse.ToDouble(value)); } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (GParse.ToDouble(value) == 0) { return(string.Empty); } else { return(value.ToString()); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == DBNull.Value) { return(string.Empty); } else { double val = Math.Round(GParse.ToDouble(value), 3); return(val); } }
//private void ExecuteItemCodeFocusLostEvent(object obj) //{ // isFocusable(); // if (!string.IsNullOrEmpty(SelectedProductMCODE)) // { // if (_SetOnlyDefaultUnitInPurcahse == false) // { // if (productObj.AlternateUnits.Count == 1) // { // UnitFocus = "None"; // } // } // else { UnitFocus = "None"; } // if (_PrateEdit == false) // { // RateFocus = false; // } // } //} //private void ExecuteBarcodeFocusLostEvent(object obj) //{ // isFocusable(); // if (!string.IsNullOrEmpty(BARCODE)) // { // ItemCodeFocus = "None"; // if (_SetOnlyDefaultUnitInPurcahse == false) // { // if (productObj.AlternateUnits.Count == 1) // { // UnitFocus = "None"; // } // } // else { UnitFocus = "None"; } // if (_PrateEdit == false) // { // RateFocus = false; // } // } //} #endregion #region execute command private void ExecuteGridLoad(object obj) { if (SelectedTrnProd != null) { TrnProdObj = GParse.CopyPropertyValues(SelectedTrnProd, new TrnProd()) as TrnProd; SelectedProductMCODE = TrnProdObj.MCODE; SelectedAltUnit = _productObj.AlternateUnits.Where(x => x.ALTUNIT == SelectedTrnProd.UNIT).FirstOrDefault(); SelectedWarehouse = TrnProdObj.WAREHOUSE; _BARCODE = TrnProdObj.BC; OnPropertyChanged("BARCODE"); TrnMainBaseModelObj.ProdList.Remove(SelectedTrnProd); } }
void PrintBill(string BillNo, SqlConnection conn) { DataRow dr; //// RawPrinterHelper printer = new RawPrinterHelper(); using (DataAccess da = new DataAccess()) { dr = da.getData(string.Format(@"SELECT PS.*,VT.Description VType,ISNULL(PIN.PlateNo,'') PlateNo,PIN.InTime,PIN.InMiti,POUT.OutTime,POUT.OutMiti,U.UserName, POUT.Interval, POUT.ChargedHours FROM ParkingSales PS INNER JOIN Users U ON U.UID = PS.UID LEFT JOIN ParkingOutDetails POUT ON PS.PID = POUT.PID AND PS.FYID = POUT.FYID LEFT JOIN (ParkingInDetails PIN LEFT JOIN VehicleType VT ON VT.VTypeID=PIN.VehicleType) ON PS.PID = PIN.PID AND PS.FYID = PIN.FYID WHERE BillNo = '{0}' AND PS.FYID = {1}", BillNo, GlobalClass.FYID), conn).Rows[0]; } string strPrint = string.Empty; int PrintLen = 40; string Description = dr["Description"].ToString(); string Particulars = "Particulars"; Description = (Description.Length > PrintLen - 17) ? Description.Substring(0, PrintLen - 17) : Description.PadRight(PrintLen - 17, ' '); Particulars = (Particulars.Length > PrintLen - 17) ? Particulars.Substring(0, PrintLen - 17) : Particulars.PadLeft((PrintLen + Particulars.Length - 17) / 2, ' ').PadRight(PrintLen - 17, ' '); strPrint += (GlobalClass.CompanyName.Length > PrintLen) ? GlobalClass.CompanyName.Substring(0, PrintLen) : GlobalClass.CompanyName.PadLeft((PrintLen + GlobalClass.CompanyName.Length) / 2, ' ') + Environment.NewLine; strPrint += (GlobalClass.CompanyAddress.Length > PrintLen) ? GlobalClass.CompanyAddress.Substring(0, PrintLen) : GlobalClass.CompanyAddress.PadLeft((PrintLen + GlobalClass.CompanyAddress.Length) / 2, ' ') + Environment.NewLine; strPrint += "Parking Invoice".PadLeft((PrintLen + GlobalClass.CompanyName.Length) / 2, ' ') + Environment.NewLine; strPrint += string.Format("Bill No : {0} Date : {1}", BillNo.PadRight(7, ' '), dr["TMiti"]) + Environment.NewLine; strPrint += string.Format("Received From : {0}", dr["BillTo"]) + Environment.NewLine; strPrint += "".PadRight(PrintLen, '-') + Environment.NewLine; strPrint += string.Format("Sn.|{0}| Amount |", Particulars) + Environment.NewLine; strPrint += string.Format("1. {0} {1}", Description, GParse.ToDecimal(dr["GrossAmount"]).ToString("#0.00").PadLeft(8, ' ')) + Environment.NewLine; //strPrint += string.Format(" IN : {0} {1}", dr["InTime"], dr["InMiti"]) + Environment.NewLine; //strPrint += string.Format(" OUT : {0} {1}", dr["OutTime"], dr["OutMiti"]) + Environment.NewLine; //strPrint += string.Format(" Interval : {0} ", dr["Interval"]) + Environment.NewLine; //strPrint += string.Format(" Charged Hours : {0} ", dr["ChargedHours"]) + Environment.NewLine; strPrint += Environment.NewLine; strPrint += Environment.NewLine; strPrint += "".PadRight(PrintLen, '-') + Environment.NewLine; strPrint += string.Format("Cashier : {0} ({1})", dr["UserName"], dr["TTime"]) + Environment.NewLine; strPrint += Environment.NewLine; strPrint += Environment.NewLine; strPrint += Environment.NewLine; strPrint += Environment.NewLine; strPrint += "".PadRight(PrintLen, '-') + Environment.NewLine; strPrint += ((char)29).ToString() + ((char)86).ToString() + ((char)1).ToString(); RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, strPrint, "Receipt"); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == DBNull.Value) { return(string.Empty); } if (GParse.ToDecimal(value) == 0) { return(string.Empty); } else { return(value); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var sales = value as IEnumerable <object>; if (sales == null) { return("0.00"); } decimal sum = 0; foreach (var u in sales) { DataItem obj = u as DataItem; sum += GParse.ToDecimal(obj.GetType().GetProperty(parameter.ToString()).GetValue(obj, null)); } return(sum.ToString("#0.00")); }
int getMinutes(string duration) { string[] hrsMins; int hrs = 0, min = 0, TotMins; if (string.IsNullOrEmpty(duration) || duration == "N/A") { return(0); } try { if (duration.Contains(" ")) { hrsMins = duration.Split(' '); if (hrsMins.Length == 2) { hrs = GParse.ToInteger(hrsMins[0].Replace("Hrs", string.Empty)); min = GParse.ToInteger(hrsMins[1].Replace("Min", string.Empty)); } else if (hrsMins.Length == 4) { hrs = GParse.ToInteger(hrsMins[0]); min = GParse.ToInteger(hrsMins[2]); } } else if (duration.Contains("Hrs")) { hrs = GParse.ToInteger(duration.Replace("Hrs", string.Empty)); min = 0; } else { hrs = 0; min = GParse.ToInteger(duration.Replace("Min", string.Empty)); } } catch (Exception ex) { MessageBox.Show(ex.Message, MessageBoxCaption, MessageBoxButton.OK, MessageBoxImage.Error); } TotMins = hrs * 60 + min; return(TotMins); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value == DBNull.Value) { return(string.Empty); } if (GParse.ToDecimal(value) == 0) { return(string.Empty); } else if (GParse.ToString(parameter) == "NO_DECIMAL") { return(GParse.ToDecimal(value).ToString("#0")); } else { return(value); } }
void CalculateParkingCharge(SqlConnection conn, DateTime InTime, DateTime OutTime, int RateId, int VehicleID) { using (SqlCommand cmd = conn.CreateCommand()) { conn.Open(); cmd.CommandText = "sp_Calculate_PCharge"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@InTime", InTime); cmd.Parameters.AddWithValue("@OutTime", OutTime); cmd.Parameters.AddWithValue("@RateId", RateId); cmd.Parameters.AddWithValue("@VehicleId", VehicleID); using (SqlDataReader dr = cmd.ExecuteReader()) { if (dr.Read()) { POUT.ChargedAmount = GParse.ToDecimal(dr[0]); POUT.ChargedHours = (decimal)dr[1]; } } } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return(GParse.ToBool(value) ? "Save" : "New"); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var result = GParse.ToDecimal(value); return((result > 0) ? ((parameter == null) ? result.ToString("#0.00") : result.ToString()) : string.Empty); }
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return(GParse.ToDecimal(value.ToString().Substring(0, value.ToString().Length - 3))); }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return(GParse.ToLong(value)); }
void PrintBill(int BillNo) { DataRow dr; //// RawPrinterHelper printer = new RawPrinterHelper(); using (SqlConnection conn = new SqlConnection(GlobalClass.TConnectionString)) using (DataAccess da = new DataAccess()) { conn.Open(); dr = da.getData(string.Format(@"SELECT PS.*,VT.Description VType,ISNULL(PIN.PlateNo,'') PlateNo,PIN.InTime,PIN.InMiti,POUT.OutTime,POUT.OutMiti,U.UserName, POUT.Interval, POUT.ChargedHours FROM ParkingSales PS INNER JOIN Users U ON U.UID = PS.UID LEFT JOIN ParkingOutDetails POUT ON PS.PID = POUT.PID AND PS.FYID = POUT.FYID LEFT JOIN (ParkingInDetails PIN LEFT JOIN VehicleType VT ON VT.VTypeID=PIN.VehicleType) ON PS.PID = PIN.PID AND PS.FYID = PIN.FYID WHERE BillNo = {0} AND PS.FYID = {1}", BillNo, GlobalClass.FYID), conn).Rows[0]; } RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, " " + GlobalClass.CompanyName + Environment.NewLine, "Receipt"); RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, " " + GlobalClass.CompanyAddress + Environment.NewLine, "Receipt"); RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, " Parking Invoice" + Environment.NewLine, "Receipt"); RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, "Bill No : " + (BillNo + " ").Substring(0, 10) + " Date : " + dr["TMiti"] + Environment.NewLine, "Receipt"); RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, Environment.NewLine, "Receipt"); RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, "------------------------------------------------" + Environment.NewLine, "Receipt"); RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, "Sno. | Particulars | Amount |" + Environment.NewLine, "Receipt"); RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, "------------------------------------------------" + Environment.NewLine, "Receipt"); RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, "1. " + dr["Description"] + " " + GParse.ToDecimal(dr["GrossAmount"]).ToString("#0.00") + " " + Environment.NewLine, "Receipt"); // RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, " IN : " + dr["InTime"] + " " + dr["InMiti"] + " " + Environment.NewLine, "Receipt"); //RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, " OUT : " + dr["OutTime"] + " " + dr["OutMiti"] + " " + Environment.NewLine, "Receipt"); RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, Environment.NewLine, "Receipt"); RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, Environment.NewLine, "Receipt"); RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, "------------------------------------------------" + Environment.NewLine, "Receipt"); RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, "Cashier : " + dr["UserName"] + "(" + dr["TTime"] + ")" + Environment.NewLine, "Receipt"); RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, Environment.NewLine, "Receipt"); RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, Environment.NewLine, "Receipt"); RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, "------------------------------------------------", "Receipt"); RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, ((char)29).ToString() + ((char)86).ToString() + ((char)1).ToString(), "Receipt"); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { //return Visibility.Visible; return(GParse.ToInteger(value) == 0 ? false : true); //return (bool)value ? Visibility.Visible : Visibility.Collapsed; }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return(GParse.ToDecimal(value) * 100); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return(GParse.getHHMMString(value, true)); }
void PrintBill(string BillNo, SqlConnection conn, string InvoiceName, string DuplicateCaption = "") { DataRow dr; //string DuplicateCaption = GlobalClass.GetReprintCaption(BillNo); //// RawPrinterHelper printer = new RawPrinterHelper(); using (DataAccess da = new DataAccess()) { dr = da.getData(string.Format(@"SELECT PS.*,VT.Description VType,ISNULL(PIN.PlateNo,'') PlateNo,PIN.InTime,PIN.InMiti,POUT.OutTime,POUT.OutMiti,U.UserName, POUT.Interval, POUT.ChargedHours FROM ParkingSales PS INNER JOIN Users U ON U.UID=PS.UID LEFT JOIN ParkingOutDetails POUT ON PS.PID = POUT.PID AND PS.FYID = POUT.FYID LEFT JOIN (ParkingInDetails PIN LEFT JOIN VehicleType VT ON VT.VTypeID=PIN.VehicleType) ON PS.PID = PIN.PID AND PS.FYID = PIN.FYID WHERE BillNo = '{0}' AND PS.FYID = {1}", BillNo, GlobalClass.FYID), conn).Rows[0]; } string InWords = GlobalClass.GetNumToWords(conn, Convert.ToDecimal(dr["GrossAmount"])); string strPrint = string.Empty; int PrintLen = 40; string Description = dr["Description"].ToString(); string Particulars = "Particulars"; Description = (Description.Length > PrintLen - 17) ? Description.Substring(0, PrintLen - 17) : Description.PadRight(PrintLen - 17, ' '); Particulars = (Particulars.Length > PrintLen - 17) ? Particulars.Substring(0, PrintLen - 17) : Particulars.PadLeft((PrintLen + Particulars.Length - 17) / 2, ' ').PadRight(PrintLen - 17, ' '); strPrint += (GlobalClass.CompanyName.Length > PrintLen) ? GlobalClass.CompanyName.Substring(0, PrintLen) : GlobalClass.CompanyName.PadLeft((PrintLen + GlobalClass.CompanyName.Length) / 2, ' ') + Environment.NewLine; strPrint += (GlobalClass.CompanyAddress.Length > PrintLen) ? GlobalClass.CompanyAddress.Substring(0, PrintLen) : GlobalClass.CompanyAddress.PadLeft((PrintLen + GlobalClass.CompanyAddress.Length) / 2, ' ') + Environment.NewLine; strPrint += GlobalClass.CompanyPan.PadLeft((PrintLen + GlobalClass.CompanyPan.Length) / 2, ' ') + Environment.NewLine; strPrint += InvoiceName.PadLeft((PrintLen + InvoiceName.Length) / 2, ' ') + Environment.NewLine; if (!string.IsNullOrEmpty(DuplicateCaption)) { strPrint += DuplicateCaption.PadLeft((PrintLen + DuplicateCaption.Length) / 2, ' ') + Environment.NewLine; } strPrint += string.Format("Bill No : {0} Date : {1}", BillNo.PadRight(7, ' '), dr["TMiti"]) + Environment.NewLine; strPrint += string.Format("Name : {0}", dr["BillTo"]) + Environment.NewLine; strPrint += string.Format("Address : {0}", dr["BillToAdd"]) + Environment.NewLine; strPrint += string.Format("PAN : {0}", dr["BillToPan"]) + Environment.NewLine; strPrint += string.Format("Ref No : {0}", dr["RefBillNo"]) + Environment.NewLine; strPrint += string.Format("C/N Remarks: {0}", dr["Remarks"]) + Environment.NewLine; strPrint += string.Format("Vehicle Type : {0} {1}", dr["VType"], string.IsNullOrEmpty(dr["PlateNo"].ToString()) ? string.Empty : "(" + dr["PlateNo"] + ")") + Environment.NewLine; strPrint += "".PadRight(PrintLen, '-') + Environment.NewLine; strPrint += string.Format("Sn.|{0}| Amount |", Particulars) + Environment.NewLine; strPrint += string.Format("1. {0} {1}", Description, GParse.ToDecimal(((bool)dr["TaxInvoice"]) ? dr["Amount"] : dr["GrossAmount"]).ToString("#0.00").PadLeft(8, ' ')) + Environment.NewLine; strPrint += string.Format(" IN : {0} {1}", dr["InTime"], dr["InMiti"]) + Environment.NewLine; strPrint += string.Format(" OUT : {0} {1}", dr["OutTime"], dr["OutMiti"]) + Environment.NewLine; strPrint += string.Format(" Interval : {0} ", dr["Interval"]) + Environment.NewLine; strPrint += string.Format(" Charged Hours : {0} ", dr["ChargedHours"]) + Environment.NewLine; strPrint += Environment.NewLine; strPrint += "------------------------".PadLeft(PrintLen, ' ') + Environment.NewLine; if ((bool)dr["TaxInvoice"]) { strPrint += ("Gross Amount : " + GParse.ToDecimal(dr["Amount"]).ToString("#0.00").PadLeft(8, ' ')).PadLeft(PrintLen, ' ') + Environment.NewLine; if (GParse.ToDecimal(dr["Discount"]) > 0) { strPrint += ("Discount : " + GParse.ToDecimal(dr["Discount"]).ToString("#0.00").PadLeft(8, ' ')).PadLeft(PrintLen, ' ') + Environment.NewLine; } strPrint += ("Taxable : " + GParse.ToDecimal(dr["Taxable"]).ToString("#0.00").PadLeft(8, ' ')).PadLeft(PrintLen, ' ') + Environment.NewLine; strPrint += ("Non Taxable : " + GParse.ToDecimal(dr["NonTaxable"]).ToString("#0.00").PadLeft(8, ' ')).PadLeft(PrintLen, ' ') + Environment.NewLine; strPrint += ("VAT 13% : " + GParse.ToDecimal(dr["VAT"]).ToString("#0.00").PadLeft(8, ' ')).PadLeft(PrintLen, ' ') + Environment.NewLine; } strPrint += ("Net Amount : " + GParse.ToDecimal(dr["GrossAmount"]).ToString("#0.00").PadLeft(8, ' ')).PadLeft(PrintLen, ' '); strPrint += Environment.NewLine; strPrint += "".PadRight(PrintLen, '-') + Environment.NewLine; strPrint += InWords + Environment.NewLine; strPrint += "".PadRight(PrintLen, '-') + Environment.NewLine; strPrint += string.Format("Cashier : {0} ({1})", dr["UserName"], dr["TTime"]) + Environment.NewLine; strPrint += Environment.NewLine; strPrint += Environment.NewLine; strPrint += Environment.NewLine; strPrint += Environment.NewLine; strPrint += "".PadRight(PrintLen, '-') + Environment.NewLine; strPrint += ((char)29).ToString() + ((char)86).ToString() + ((char)1).ToString(); if (GlobalClass.NoRawPrinter) { new StringPrint(strPrint).Print(); } else { RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, strPrint, "Receipt"); } }
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return(GParse.ToLong(value)); }