void ReaderController.ReaderStateChangedListener.onDecodeError(DecodeResult decodeResult) { NetTracer.Warning(string.Format("The decode error occured : {0}", decodeResult.ToString())); // Restart the device to capture the swipe information again. this.StartReader(); }
/// <summary> /// Encodes the text to for Code39 /// </summary> /// <param name="text">The text.</param> /// <returns>Encoded string.</returns> public override string Encode(string text) { NetTracer.Information("Peripheral [BarcodeCode39] - Encode"); if (text == null) { throw new ArgumentNullException("text"); } StringBuilder result = new StringBuilder(text.Length + 2); // Add start character result.Append(START_END_MARKER); foreach (char ch in text) { if (supportedCharacters.BinarySearch(ch) >= 0) { result.Append(ch); } else { NetTracer.Warning("Peripheral [BarcodeCode39] - Unsupported character '{0}' elided.", ch); } } // Replace Space with comma result.Replace(' ', ','); // Add stop character result.Append(START_END_MARKER); return(result.ToString()); }
void ReaderController.ReaderStateChangedListener.onError(string message) { NetTracer.Warning(string.Format("An error occured : {0}", message)); // Restart the device to capture the swipe information again. this.StartReader(); }
/// <summary> /// Process Linked InfoCodes for TenderLineItem /// </summary> /// <param name="posTransaction"></param> /// <param name="tenderLineItem"></param> /// <param name="storeId"></param> /// <param name="tableRefId"></param> /// <param name="infoCodeType"></param> public void ProcessLinkedInfoCodes(IPosTransaction posTransaction, ITenderLineItem tenderLineItem, string storeId, InfoCodeTableRefType tableRefId, InfoCodeType infoCodeType) { TenderLineItem lineItem = tenderLineItem as TenderLineItem; if (lineItem == null) { NetTracer.Warning("tenderLineItem parameter is null"); throw new ArgumentNullException("tenderLineItem"); } //Loop while a linkedInfoCode is found int i = 0; //Set as a stop for a infinite loop LinkedListNode <InfoCodeLineItem> infoCodeItem = lineItem.InfoCodeLines.Last; if (infoCodeItem != null) { while (!string.IsNullOrEmpty(infoCodeItem.Value.LinkedInfoCodeId) && (i < 10)) { ProcessInfoCode(posTransaction, 0, lineItem.Amount, storeId, lineItem.TenderTypeId, lineItem.CurrencyCode, tableRefId, infoCodeItem.Value.LinkedInfoCodeId, infoCodeItem.Value, infoCodeType); // This is to prevent an infinite loop when infocodes link to themselves.. if (infoCodeItem.Value.LinkedInfoCodeId == lineItem.InfoCodeLines.Last.Value.LinkedInfoCodeId) { break; } infoCodeItem = lineItem.InfoCodeLines.Last; i++; } } }
/// <summary> /// Given a transaction, choose the discounts which should be active on each line /// according to the concurrency rules and add them to the sales items /// </summary> /// <param name="retailTransaction">Transaction whose discounts and sales items will be processed</param> public static void ApplyConcurrencyRules(RetailTransaction retailTransaction) { if (retailTransaction == null) { NetTracer.Warning("retailTransaction parameter is null"); throw new ArgumentNullException("retailTransaction"); } // In order to choose the best discount to apply when choosing from multiple we need to know // the effect of the offer on the whole transaction. So we get a list of offers on the transaction // for each type of concurrency, and sort them with largest discounts first. List <OfferGroup> sortedExclusiveOffers; List <OfferGroup> sortedBestPriceOffers; List <OfferGroup> sortedConcurrentOffers; GetSortedOfferLists(retailTransaction, out sortedExclusiveOffers, out sortedBestPriceOffers, out sortedConcurrentOffers); // Then, starting with exclusive offers, then best price, then compound offers, we find the best that apply. // We keep track of applied offers to given them priority. This ensures that once a line in a discount group (like mix and match) // chooses an offer, the rest of the members of the group will see the offer first. // We keep track of rejected offers to exclude them from consideration. This ensures that once an exclusive offer or best price // offer is chosen, no other offers one that line are available for use. Example would be if an exclusive multibuy on an item // is activated and a mix and match offer is also available for that item. The exclusive multibuy takes priority and no other // items in that mix and match group should be able to have the mix and match discount. HashSet <OfferGroup> appliedOffers = new HashSet <OfferGroup>(); HashSet <OfferGroup> rejectedOffers = new HashSet <OfferGroup>(); ApplyPeriodicDiscounts(retailTransaction, ConcurrencyMode.Exclusive, sortedExclusiveOffers, appliedOffers, rejectedOffers); ApplyPeriodicDiscounts(retailTransaction, ConcurrencyMode.BestPrice, sortedBestPriceOffers, appliedOffers, rejectedOffers); ApplyPeriodicDiscounts(retailTransaction, ConcurrencyMode.Compounded, sortedConcurrentOffers, appliedOffers, rejectedOffers); }
private static DiscountMethodType GetDiscountMethodType(PeriodicDiscountOfferType periodicDiscountType, int discountTypeFromDatabase) { DiscountMethodType discountMethod = DiscountMethodType.DealPrice; // ISNULL(pdmm.MIXANDMATCHDISCOUNTTYPE, ISNULL(pdmb.MULTIBUYDISCOUNTTYPE, pd.PERIODICDISCOUNTTYPE)) switch (periodicDiscountType) { case PeriodicDiscountOfferType.Offer: case PeriodicDiscountOfferType.Promotion: discountMethod = DiscountMethodType.LineSpecific; break; case PeriodicDiscountOfferType.MixAndMatch: case PeriodicDiscountOfferType.MultipleBuy: discountMethod = (DiscountMethodType)discountTypeFromDatabase; break; case PeriodicDiscountOfferType.Threshold: discountMethod = DiscountMethodType.LineSpecific; break; default: NetTracer.Warning("Unsupported discount type: {0}", discountTypeFromDatabase); break; } return(discountMethod); }
/// <summary> /// Add all information about the item.. /// </summary> /// <param name="saleLineItem">The sale line item.</param> /// <param name="bypassSerialNumberEntry">if set to <c>true</c> [bypass serial number entry].</param> /// <returns></returns> public void ProcessItem(ISaleLineItem saleLineItem, bool bypassSerialNumberEntry) { SaleLineItem lineItem = (SaleLineItem)saleLineItem; if (lineItem == null) { NetTracer.Warning("saleLineItem parameter is null"); throw new ArgumentNullException("saleLineItem"); } try { if (!string.IsNullOrEmpty(lineItem.ItemId)) { GetInventTableInfo(ref lineItem); if (lineItem.Found) { GetInventTableModuleInfo(ref lineItem); GetRBOInventTableInfo(ref lineItem); GetInventDimInfo(ref lineItem); if (!bypassSerialNumberEntry) { GetDimensionGroupInfo(ref lineItem); } } } } catch (Exception ex) { LSRetailPosis.ApplicationExceptionHandler.HandleException(this.ToString(), ex); throw; } }
/// <summary> /// Plays a given system sound theme. /// </summary> /// <param name="soundThemeName">Name of the sound theme.</param> private static void PlaySound(string soundThemeName) { const string SoundThemeRegKeyRoot = @"AppEvents\Schemes\Apps\sapisvr"; // 'Speech Recognition' Group const string CurrentSoundFileKey = ".Current"; try { using (RegistryKey soundThemeKey = Registry.CurrentUser.OpenSubKey(Path.Combine(SoundThemeRegKeyRoot, soundThemeName, CurrentSoundFileKey))) { if (soundThemeKey != null) { string soundFileName = soundThemeKey.GetValue(string.Empty) as string; // Default value of key is Sound file path. if (!string.IsNullOrWhiteSpace(soundFileName) && File.Exists(soundFileName)) { using (SoundPlayer soundPlayer = new SoundPlayer(soundFileName)) { soundPlayer.Play(); } } } } } catch (Exception ex) { NetTracer.Warning(ex, "LogOnDevice:PlaySound failed."); } }
/// <summary> /// Blind closes the current shift. /// </summary> /// <param name="transaction">The current transaction instance.</param> public void BlindCloseShift(IPosTransaction transaction) { if (transaction == null) { NetTracer.Warning("transaction parameter is null"); throw new ArgumentNullException("transaction"); } // Are you sure you want to close the batch? DialogResult dialogResult = this.Application.Services.Dialog.ShowMessage(51308, MessageBoxButtons.YesNo, MessageBoxIcon.Question); { if (dialogResult == DialogResult.Yes) { BatchData batchData = new BatchData(Application.Settings.Database.Connection, Application.Settings.Database.DataAreaID); transaction.Shift.Status = PosBatchStatus.BlindClosed; transaction.Shift.StatusDateTime = DateTime.Now; transaction.Shift.OpenedAtTerminal = string.Empty; transaction.Shift.CashDrawer = string.Empty; batchData.UpdateBatch(transaction.Shift); ShiftUsersCache.Remove(transaction.Shift); transaction.Shift.Print(); this.Application.Services.Dialog.ShowMessage(51342); } else { ((PosTransaction)transaction).EntryStatus = PosTransaction.TransactionStatus.Cancelled; } } }
public TaxCodeProviderIndia(IApplication application) : base(application) { SqlConnection connection = application.Settings.Database.Connection; try { // Read parameters from the Tax parameters table DBUtil dbUtil = new DBUtil(connection); DataTable tbTaxParameters = dbUtil.GetTable("SELECT VAT_IN, SERVICETAX_IN, SALESTAX_IN FROM TAXPARAMETERS"); taxParameterServiceIn = (int)tbTaxParameters.Rows[0]["SERVICETAX_IN"] == 1; taxParameterVatIn = (int)tbTaxParameters.Rows[0]["VAT_IN"] == 1; taxParameterSalesIn = (int)tbTaxParameters.Rows[0]["SALESTAX_IN"] == 1; if (taxParameterSalesIn) { salesTaxFormTypesIn = GetSalesTaxFormTypes(); } } catch (Exception ex) { NetTracer.Warning(ex, "TaxCodeProviderIndia(): handled an exception: {0}", ex.Message); LSRetailPosis.ApplicationExceptionHandler.HandleException("TaxCodeProviderIndia", ex); // Not necessary to rethrow because tax parameters are set to default state. } finally { if (connection.State == ConnectionState.Open) { connection.Close(); } } }
void ReaderController.ReaderStateChangedListener.onDecodeCompleted(Dictionary <string, string> decodeData) { NetTracer.Information(string.Format("Entering onDecodeCompleted event...")); if (this.RamblerCardSwipeEvent != null) { // The card has been read and decoded. // Now parse the received data and send it to the subscriber lock (SyncLock) { if (!this.isCardReaderEnabled) { return; } try { RamblerMagneticStripeCardData ramblerCardData = new RamblerMagneticStripeCardData(); // Parse the received data and return card ramblerCardData.ParseCard(decodeData); // Notify the client with the rambler card data. this.NotifyCompleted(ramblerCardData); } catch { NetTracer.Warning(string.Format("The tracks information are not extracted correctly. Retrying again...")); // Restart the device to capture the swipe information again. this.StartReader(); } } } }
/// <summary> /// Initializes a new instance of the <see cref="SearchViewModel"/> class. /// </summary> /// <param name="searchType">Startup type of the search.</param> /// <param name="searchTerm">The search term.</param> public SearchViewModel(SearchType searchType, string searchTerm) { this.MinimumSearchTermLengh = MINIMUM_SEARCH_TERM_LENGTH; this.SearchTerms = searchTerm ?? string.Empty; this.SearchType = searchType; // If search type is category then search term is the "Category RecId" if (searchType == SearchType.Category) { Tuple <string, long> categoryDetail; if ((long.TryParse(SearchTerms, out this.searchCategoryId)) && (categoryDetail = itemData.GetCategoryDetails(searchCategoryId)) != null) { this.SearchTerms = categoryDetail.Item1; this.searchCategoryHierarchyId = categoryDetail.Item2; } else { NetTracer.Warning("SearchViewModel : Invalid category specified '{0}'", searchTerm); } } if (searchCategoryHierarchyId == 0) { this.searchCategoryHierarchyId = itemData.GetRetailProductHierarchy(); } }
private bool ShowPinEntry(string strFormName, string optionalCardNumber) { bool success = false; try { if (this.DeviceIsConnected()) { if (!string.IsNullOrWhiteSpace(optionalCardNumber)) { this.fpe.SetVariableValue("cnum", optionalCardNumber); } this.fpe.GoToScreen(strFormName); success = true; } } catch (COMException ex) { NetTracer.Warning(ex, "L5300Terminal - FPE COM exception for PinPadFrm"); } return(success); }
private bool ShowForm(string strFormName, IEnumerable <FormProperty> properties) { bool success = false; try { if (this.DeviceIsConnected()) { this.fpe.GoToScreen(strFormName); if (strFormName == "TransactionMsrFrm" && properties != null) { this.DisplayLines(properties.ToArray()); } success = true; } } catch (COMException ex) { NetTracer.Warning(ex, "L5300Terminal - FPE COM exception"); } return(success); }
private static RoundingUnitAndMethod GetRoundingUnitAndMethod(RequestContext context, string currencyCode, bool useSalesRounding) { GetCurrencyByCodeDataRequest dataRequest = new GetCurrencyByCodeDataRequest(currencyCode, new ColumnSet()); var currency = context.Execute <SingleEntityDataServiceResponse <Currency> >(dataRequest).Entity; decimal roundingUnit = Rounding.DefaultRoundingValue; RoundingMethod roundingMethod = RoundingMethod.Nearest; if (currency != null) { roundingUnit = useSalesRounding ? currency.RoundOffSales : currency.RoundOffPrice; if (roundingUnit == decimal.Zero) { roundingUnit = Rounding.DefaultRoundingValue; } int roundoffType = useSalesRounding ? currency.RoundOffTypeSales : currency.RoundOffTypePrice; roundingMethod = Rounding.ConvertRoundOffTypeToRoundingMethod(roundoffType); } else { NetTracer.Warning("No currency found for currency code {0}. Falling back to default rounding value ({1}).", currencyCode, Rounding.DefaultRoundingValue); } return(new RoundingUnitAndMethod(roundingUnit, roundingMethod)); }
/// <summary> /// Prompt for return reason code and add to transaction. /// </summary> /// <param name="customerOrderTransaction">Transaction to update.</param> private static void ProcessReturnReasonCodes(CustomerOrderTransaction customerOrderTransaction) { if (customerOrderTransaction == null) { NetTracer.Warning("customerOrderTransaction parameter is null"); throw new ArgumentNullException("customerOrderTransaction"); } // Process codes only if it is a return order and has items selected. if (customerOrderTransaction.Mode == CustomerOrderMode.Return && customerOrderTransaction.SaleItems != null && customerOrderTransaction.SaleItems.Count > 0) { string selectedValue; DialogResult dialogResult = SalesOrder.InternalApplication.Services.Dialog.GenericLookup( SalesOrder.GetReturnReasonCodes() as IList, "Description", ApplicationLocalizer.Language.Translate(99524), // Return Reason "ReasonCodeId", out selectedValue, null); if (dialogResult == DialogResult.OK) { customerOrderTransaction.ReturnReasonCodeId = selectedValue; } } }
/// <summary> /// Sets the specified product prices on the product collection. /// </summary> /// <param name="productPrices">The product prices, calculated by the pricing service.</param> /// <param name="productMap">Products by product id.</param> /// <param name="productLookupIdMap">Product lookup map, including variant ids.</param> internal static void SetProductPrices( ReadOnlyCollection <ProductPrice> productPrices, Dictionary <long, Product> productMap, Dictionary <long, long> productLookupIdMap) { foreach (var price in productPrices) { long targetProdId = price.ProductId; long crtProdId; Product crtProduct; if (!productLookupIdMap.TryGetValue(targetProdId, out crtProdId) || !productMap.TryGetValue(productLookupIdMap[targetProdId], out crtProduct)) { NetTracer.Warning("price data returned for unknown target product id {0}.", targetProdId); continue; } ProductVariant crtVariant; if (price.IsVariantPrice && crtProduct.IsMasterProduct && crtProduct.TryGetVariant(targetProdId, out crtVariant)) { crtVariant.SetPrice(price); continue; } crtProduct.SetPrice(price); } }
/// <summary> /// Read the formula from the DB for the given group and code. /// </summary> /// <param name="taxGroup"></param> /// <param name="taxCode"></param> /// <returns></returns> public static Formula GetFormula(string taxGroup, string taxCode) { // Default value for the formula Formula formula = new Formula { TaxableBasis = TaxableBases.LineAmount, PriceIncludesTax = false, Id = 0, // Since Id's are always greater than 0 in AX, this 0 value indicates formula was not found. CalculationExpression = String.Empty }; try { using (SqlCommand command = new SqlCommand()) { command.Connection = Connection; command.CommandText = @"SELECT TAXABLEBASIS, PRICEINCLTAX, ID, CALCEXP1 FROM dbo.FORMULADESIGNER_IN WHERE TAXITEMGROUP = @TaxItemGroup AND TAXCODE = @TaxCode AND DATAAREAID = @DataAreaID" ; command.Parameters.AddWithValue("@TaxItemGroup", taxGroup); command.Parameters.AddWithValue("@TaxCode", taxCode); command.Parameters.AddWithValue("@DataAreaID", ApplicationSettings.Database.DATAAREAID); if (Connection.State != ConnectionState.Open) { Connection.Open(); } using (SqlDataReader reader = command.ExecuteReader()) { if (reader.Read()) { formula.TaxableBasis = (TaxableBases)reader["TAXABLEBASIS"]; formula.PriceIncludesTax = (int)reader["PRICEINCLTAX"] == 1; formula.Id = (int)reader["ID"]; formula.CalculationExpression = (string)reader["CALCEXP1"]; } else { NetTracer.Warning("GetFormula: Formula set to default. Unable to obtain formula from DB. No rows present for taxGroup: {0}; taxCode: {1}; DataAreaID: {2}", taxGroup, taxCode, ApplicationSettings.Database.DATAAREAID); } } } } catch (Exception ex) { NetTracer.Warning(ex, "GetFormula: Formula set to default. Unable to obtain formula from DB due to an exception. taxGroup: {0}; taxCode: {1}", taxGroup, taxCode); LSRetailPosis.ApplicationExceptionHandler.HandleException("FormulaData", ex); // Not necessary to rethrow because formula is set to default state. } finally { if (Connection.State == ConnectionState.Open) { Connection.Close(); } } return(formula); }
/// <summary> /// Given a set of promotion lines, tentative item price, and item, calculate the price after promotions are applied /// </summary> /// <param name="promotionLines">List of promotion configurations active for this item</param> /// <param name="price">Price of the item before the promotion, derived from trade agreement or base item price</param> /// <param name="saleItem">The sale item whose price is being determined</param> /// <returns>Unrounded price after applying all promotions</returns> public static decimal CalculatePromotionPrice(IEnumerable <PromotionInfo> promotionLines, decimal price, BaseSaleItem saleItem) { if (saleItem == null) { NetTracer.Warning("saleItem parameter is null"); throw new ArgumentNullException("saleItem"); } if (promotionLines == null || promotionLines.Count() == 0) { return(price); } decimal promoPrice = price; IList <PromoPrice> promoPrices = new List <PromoPrice>(); foreach (PromotionInfo promo in promotionLines) { PromoPrice promoLine = new PromoPrice(); promoLine.PromoId = promo.PromoId; promoLine.Concurrency = promo.Concurrency; promoLine.IsCompoundable = false; switch (promo.DiscountMethod) { case DiscountMethod.DiscountPercent: promoLine.PercentOff = promo.MaxDiscPct; promoLine.IsCompoundable = true; promoPrices.Add(promoLine); break; case DiscountMethod.OfferPrice: if (!saleItem.Transaction.TaxIncludedInPrice) { promoLine.AmountOff = price - promo.Price; promoPrices.Add(promoLine); } break; case DiscountMethod.OfferPriceInclTax: if (saleItem.Transaction.TaxIncludedInPrice) { promoLine.AmountOff = price - promo.PriceInclTax; promoPrices.Add(promoLine); } break; case DiscountMethod.DiscountAmount: promoLine.AmountOff = promo.MaxDiscAmount; promoLine.IsCompoundable = true; promoPrices.Add(promoLine); break; } } promoPrice = price - FindConcurrentPromoAmount(promoPrices, price); return(promoPrice); }
/// <summary> /// Called when [application end request]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> private void OnApplicationEndRequest(object sender, EventArgs e) { var response = HttpContext.Current.Response; if (response.StatusCode == (int)HttpStatusCode.Unauthorized) { NetTracer.Warning("Authentication failed for request '{0}' from the host '{1}'", HttpContext.Current.Request.Url, HttpContext.Current.Request.UserHostAddress); response.Headers.Add(AuthenticateHeader, AuthorizationScheme); } }
/// <summary> /// Gets the sales line shipping rates for sales line group. /// </summary> /// <param name="salesLineGroup">The sales line group.</param> /// <param name="warehouseAddresses">The warehouse addresses.</param> /// <param name="itemGrossWeights">The item gross weights.</param> /// <param name="shippingAdapterConfigRecords">The shipping adapter configuration records.</param> /// <param name="requestContext">The request context.</param> /// <returns> /// An enumeration of sales line ids with corresponding shipping rates and weights. /// </returns> private static IEnumerable <SalesLineShippingRate> GetSalesLineShippingRatesPerGroup( IEnumerable <SalesLine> salesLineGroup, Dictionary <string, Address> warehouseAddresses, Dictionary <string, decimal> itemGrossWeights, IEnumerable <ShippingAdapterConfig> shippingAdapterConfigRecords, RequestContext requestContext) { // We package all the items with identical dlv mode, origin and destination addresses into one package. // Total weight of all items in current saleslines group decimal totalWeight; Address shippingDestination = null; Address shippingOrigin = null; string deliveryModeId = null; // Since destination, origin and delivery mode are identical for all lines within a group, we can grab values from any member of the list. // Does not matter if it is the first element, or the last, or anywhere in the middle. if (salesLineGroup != null && salesLineGroup.Any()) { shippingDestination = salesLineGroup.First().ShippingAddress; shippingOrigin = warehouseAddresses[salesLineGroup.First().InventoryLocationId.ToUpperInvariant()]; deliveryModeId = salesLineGroup.First().DeliveryMode; } var salesLineShippingRateList = GetSalesLineShippingRateListAndTotalWeight(salesLineGroup, itemGrossWeights, out totalWeight); ShippingRateInfo shippingRateInfo = new ShippingRateInfo { FromAddress = shippingOrigin, ToAddress = shippingDestination, GrossWeight = totalWeight }; // Get Carrier info ParameterSet adapterConfig = ExtractAdapterConfigForSpecificDeliveryMode(deliveryModeId, shippingAdapterConfigRecords); var carrierServiceRequest = new GetShippingRateFromCarrierServiceRequest(adapterConfig, shippingRateInfo); IRequestHandler carrierAdapterHandler = GetCarrierAdapterService(requestContext, carrierServiceRequest.GetType(), adapterConfig); if (carrierAdapterHandler != null) { // Contact carrier var carrierServiceResponse = requestContext.Execute <GetShippingRateFromCarrierServiceResponse>(carrierServiceRequest, carrierAdapterHandler); var totalShippingCharge = carrierServiceResponse.ShippingRate; // Redistribute rates across the salesline based on their weights foreach (var lineShippingRate in salesLineShippingRateList) { lineShippingRate.ShippingCharge = (totalShippingCharge * lineShippingRate.NetWeight) / totalWeight; } } else { NetTracer.Warning("No registered carrier adapter is found."); } return(salesLineShippingRateList); }
public void Print() { DM.CustomerDataManager customerDataManager = new DM.CustomerDataManager( ApplicationSettings.Database.LocalConnection, ApplicationSettings.Database.DATAAREAID); //Get the balances IList <DE.CustomerBalanceInfo> customerBalances = customerDataManager.GetCustomersBalances(); if ((customerBalances != null) && (customerBalances.Count > 0)) { //Print header information int charsInLine = 44; string line = "--------------------------------------------" + "\n"; string reportName = LSRetailPosis.ApplicationLocalizer.Language.Translate(51020); //"BALANCE REPORT" int leftPad = (charsInLine - reportName.Length) / 2; string report = "\n" + reportName.PadLeft(leftPad + reportName.Length) + "\n\n\n"; report += LSRetailPosis.ApplicationLocalizer.Language.Translate(51021) + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "\n\n"; //"Report printed" //Customer //Name //Balance report += LSRetailPosis.ApplicationLocalizer.Language.Translate(51022).PadRight(10).Substring(0, 10) + " " + LSRetailPosis.ApplicationLocalizer.Language.Translate(51023).PadRight(20).Substring(0, 20) + " " + LSRetailPosis.ApplicationLocalizer.Language.Translate(51024).PadLeft(12).Substring(0, 12) + "\n"; report += line; string customerId = string.Empty; string name = string.Empty; decimal balance = 0; decimal total = 0; //Loop throug the customer balances foreach (var customerBalance in customerBalances) { customerId = customerBalance.AccountNumber; name = customerBalance.Name; balance = customerBalance.Balance; total += balance; report += customerId.PadRight(10) + " " + name.PadRight(20).Substring(0, 20) + " " + (balance.ToString("n2")).PadLeft(12) + "\n"; } //Printer footer report += line; string totalText = LSRetailPosis.ApplicationLocalizer.Language.Translate(51025) + ": "; //TOTAL report += totalText.PadLeft(32) + (total.ToString("n2")).PadLeft(12) + "\n\n\n"; //Send text to printer if (((object)Customer.InternalApplication.Services.Printing) is IPrintingV2) { // Print to the default printer Customer.InternalApplication.Services.Printing.PrintDefault(true, report); } else { // Legacy support - direct print to printer #1 NetTracer.Warning("BalanceReport.Print - Printing service does not support default printer. Using printer #1"); Customer.InternalApplication.Services.Peripherals.Printer.PrintReceipt(report); } } }
private void posScale_ErrorEvent(int ResultCode, int ResultCodeExtended, int ErrorLocus, ref int pErrorResponse) { NetTracer.Warning("Peripheral [Scale] - Error Event Result Code: {0} ExtendedResultCode: {1}", ResultCode, ResultCodeExtended); if ((ResultCode != (int)OPOS_Constants.OPOS_SUCCESS) && ScaleErrorMessageEvent != null) { ScaleErrorMessageEvent(Enum.GetName(typeof(OPOS_Constants), ResultCode)); pErrorResponse = (int)OPOS_Constants.OPOS_ER_CLEAR; } }
private static void CloseOrder(ICustomerOrderTransaction transaction) { CustomerOrderTransaction cot = transaction as CustomerOrderTransaction; if (cot == null) { NetTracer.Warning("CustomerOrderTransaction is null"); throw new ArgumentNullException("CustomerOrderTransaction"); } cot.EntryStatus = PosTransaction.TransactionStatus.Cancelled; }
private void InitializeInstance() { try { this.fpe = new FPEINTERFACELib.CoFPESO(); this.connectionStatus = FPEINTERFACELib.tagTERMINALCONNECTIONSTATUS.TERMINAL_CONNECTION_STATUS_UNKNOWN; } catch (COMException ex) { NetTracer.Warning("L5300Terminal -Unable to create FPE COM object - make sure it is installed: {0}", ex.Message); this.fpe = null; } }
public HydraSignatureEnhanced(byte[] signatureData) { Contract.Assert(signatureData != null); this.signatureType = SignatureFormat.Unknown; this.id = InvalidId; // Start with an invalid ID if ((signatureData != null) && (signatureData.Length >= 1)) { // Must have at least 1 byte to be a valid signature byte[] reverseSignatureData = new byte[signatureData.Length]; for (int i = 0; i < signatureData.Length; i++) { // Reverse all bits to match "endian" reverseSignatureData[i] = ReverseByte(signatureData[i]); } this.data = new BitArray(reverseSignatureData); this.bitOffset = 0; if (this.data[0] == true) { // Legacy signature always with "Move" instruction (e.g., first bit is 1) this.signatureType = SignatureFormat.Legacy; this.startBitOffset = 0; // Start with bit(0) - "Move" } else if ((reverseSignatureData[0] == 0) && (signatureData.Length >= SignatureHeaderLength)) { // Enhanced format signature (first 8 bits must alwasy be 0) this.signatureType = SignatureFormat.Enhanced; // Signature Header: // 8: ID (all bits 0) // 8: HeaderDataLengths (MSB first, = 8) // 16: X-Axis scaled resolution (hor full-scale range up to 2048, MSB first) // 16: Y-Axis scaled resolution (vert full-scale range up to 1024, MSB fist) // 16: X-Axis physical size (withd of pad in 0.01 mm units, for the ICE5500 this is 6717 which corresponding to 67.17mm, MSB first) // 16: Y-Axis phy size (hight of pad in 0.01 mm units, MSB first) this.id = this.ReadByte(8); // Enhanced Signature first 8 bits should alwasy be zero(0) this.headerLength = this.ReadByte(8); this.startBitOffset = (2 /* this.id + len */ + this.headerLength) * 8 /* 8 bits in byte */; this.axisScaleX = this.ReadInt(16, false); this.axisScaleY = this.ReadInt(16, false); this.phySizeX = this.ReadInt(16, false); this.phySizeY = this.ReadInt(16, false); } } else { NetTracer.Warning("L5300Terminal - L5300SignatureEnhanced - null or invalid signature header"); } }
private void InitializeConnection() { try { if (this.fpe != null) { this.fpe.UseSerialCommunication(); } } catch (COMException ex) { NetTracer.Warning(ex, "L5300Terminal - FPE COM exception"); this.connectionStatus = FPEINTERFACELib.tagTERMINALCONNECTIONSTATUS.TERMINAL_CONNECTION_STATUS_UNKNOWN; } }
private DataTable GetLoyaltyPointsSchemeFromDB(string schemeID) { try { SqlSelect sqlSelect = new SqlSelect("RETAILLOYALTYPOINTSTABLE"); sqlSelect.Select("*"); sqlSelect.Where("LOYALTYSCHEMEID", schemeID, true); sqlSelect.Where("DATAAREAID", Application.Settings.Database.DataAreaID, true); return(new DBUtil(Application.Settings.Database.Connection).GetTable(sqlSelect)); } catch (Exception ex) { NetTracer.Warning(ex, "Loyalty::GetLoyaltyPointsSchemeFromDB failed for schemeID {0}. Returning null.", schemeID); return(null); } }
/// <summary> /// Calculates the item price. /// </summary> public void CalculateItemPrice() { if (this.SearchType == SearchType.Item && this.ItemPrice == null) { try { decimal price = Dialog.InternalApplication.Services.Price.GetItemPrice(this.Number, (string)this.Tag); this.ItemPrice = Dialog.InternalApplication.Services.Rounding.RoundForDisplay(price, true, true); } catch (Exception ex) { // Price calculation failure should not block operation. NetTracer.Warning(ex, "SearchResult : CalculateItemPrice : Failed to calculate price for item {0}", this.Number); } } }
private void posPinpad_ErrorEvent(int ResultCode, int ResultCodeExtended, int ErrorLocus, ref int pErrorResponse) { NetTracer.Warning("Peripheral [PinPad] - Error Event Result Code: {0} ExtendedResultCode: {1}", ResultCode, ResultCodeExtended); IPinPadInfo args = Peripherals.InternalApplication.BusinessLogic.Utility.CreatePinPadInfo(); args.DataEvent = false; args.Status = PinPadEntryStatus.Error; args.EncryptedPIN = string.Empty; args.AdditionalSecurityInformation = string.Empty; if (EntryCompleteEvent != null) { EntryCompleteEvent(this, args); } }