public Billing[] getBilling(GetBillingRequest request) { DetachedCriteria criteria = DetachedCriteria.For <Bill>(); if (request.orderby != null) { RequestOrderByHelper.ConverToCriteria(request.orderby, orderbyFiledsMapping, criteria); } IList <Bill> billList = TheCriteriaMgr.FindAll <Bill>(criteria, request.beginRowIndex, request.beginRowIndex + request.rowSize); List <Billing> billingList = new List <Billing>(); foreach (Bill bill in billList) { Billing billing = fillBill(bill); foreach (BillDetail billDetail in bill.BillDetails) { BillingItem billingItem = fillBillDetail(billDetail); billing.AddBillingItem(billingItem); } billingList.Add(billing); } return(billingList.ToArray()); }
public void RemoveBilling(BillingItem item) { if (items.Contains(item)) { items.Remove(item); } }
public static async Task <BillingItem> PurchaseProductWithTypeAsync(EVeSubscriptionType type) { var item = new BillingItem(); try { #if DEBUG Billing.InTestingMode = true; #endif var connected = await Billing.ConnectAsync(); if (!connected) { item.Message = "Error connecting to store. Check your connection and try again."; } string subscriptionProductID; switch (type) { case EVeSubscriptionType.Unknown: subscriptionProductID = ""; break; case EVeSubscriptionType.SingleSubscription: subscriptionProductID = SingleSubscriptionProductID; break; case EVeSubscriptionType.AdditionalSubscription: subscriptionProductID = AdditionalSubscriptionProductID; break; default: subscriptionProductID = ""; break; } //try to purchase item var purchase = await Billing.PurchaseAsync(subscriptionProductID, ItemType.Subscription, "apppayload"); if (purchase == null) { item.Success = false; } else { item.PurchasedItem = purchase; item.Success = true; } } catch (InAppBillingPurchaseException purchaseEx) { item.Message = $"Error in {purchaseEx.Message}"; item.Success = false; } catch (Exception ex) { item.Message = $"Issue connecting: {ex.Message}"; item.Success = false; } finally { //Disconnect, it is okay if we never connected await Billing.DisconnectAsync(); } return(item); }
private bool AddTimeEntry() { BillingItem item = new BillingItem(); item.AssociatedDate = associatedDate; item.Description = rtbDescription.Text; item.OfficeRate = (Rate)cmbRates.SelectedItem; item.OfficeRateId = item.OfficeRate.ID; item.FieldRate = (Rate)cmbRates.SelectedItem; item.FieldRateId = item.FieldRate.ID; if (isOfficeEntry) { item.OfficeTime = new TimeSpan(dtpTimeEntry.Value.Hour, dtpTimeEntry.Value.Minute, dtpTimeEntry.Value.Second); item.FieldTime = TimeSpan.Zero; } else { item.FieldTime = new TimeSpan(dtpTimeEntry.Value.Hour, dtpTimeEntry.Value.Minute, dtpTimeEntry.Value.Second); item.OfficeTime = TimeSpan.Zero; } if (item.IsValidItem) { TimeEntryAdded?.Invoke(this, new ObjectCreatedEventArgs(item, false)); return(true); } else { CMessageBox.Show("Not enough information to add new entry. " + DatabaseError.BillingItemIncomplete.ToDescriptionString(), "Error", MessageBoxButtons.OK, Resources.error_64x64); return(false); } }
public string Create(Billing mo) { try { // 1. 主表部分 // 1.1 创建人 //if (Session["LoginUser"] != null) //{ // mo.Creator = (SysUser)Session["loginUser"]; //} // 1.2 报销时间 mo.CreateDate = DateTime.Now; // 2. 明细表 mo.BillingItemList = new List <BillingItem>(); var allBillingItemType = Container.Instance.Resolve <BillingItemTypeService>().GetAll(); // 最大行数 int detailRowCount = int.Parse(Request["detailRowCount"]); // 关于行循环 for (int i = 1; i <= detailRowCount; i++) { // 检查明细行是否存在 if (Request["BillingItemType" + i] == null) { continue; } // 处理明细行输入 BillingItem bi = new BillingItem(); if (Request["ID" + i] != null) { // 原有行 bi.ID = int.Parse(Request["ID" + i]); } bi.Fee = decimal.Parse(Request["Fee" + i]); bi.Remark = Request["Remark" + i]; int billingItemTypeId = int.Parse(Request["BillingItemType" + i]); bi.BillingItemType = (from m in allBillingItemType where m.ID == billingItemTypeId select m).FirstOrDefault(); // 关联主表与从表 bi.Billing = mo; mo.BillingItemList.Add(bi); } // 3. 提交主表(级联提交明细表) Container.Instance.Resolve <BillingService>().Create(mo); // 4. 更新托运单状态 DeliveryForm deliveryForm = Container.Instance.Resolve <DeliveryFormService>().GetEntity(mo.DeliveryForm.ID); TransportOrder transportOrder = deliveryForm.TransportOrder; transportOrder.Status = 3; // 已报账 Container.Instance.Resolve <TransportOrderService>().Edit(transportOrder); return("ok"); } catch (Exception ex) { return(ex.Message); } }
private void billingGrid_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { BillingItem item = billingGrid.Rows[e.RowIndex].Tag as BillingItem; NewEntryDlg dialog = new NewEntryDlg(item.AssociatedDate, item, true); dialog.TimeEntryAdded += ProcessItem; dialog.ShowDialog(); } }
private void btnEditTime_Click(object sender, EventArgs e) { if (billingGrid.SelectedRows.Count == 1) { BillingItem item = billingGrid.SelectedRows[0].Tag as BillingItem; NewEntryDlg dialog = new NewEntryDlg(item.AssociatedDate, item, true); dialog.TimeEntryAdded += ProcessItem; dialog.ShowDialog(); } }
/// <summary> /// Adds the item. /// </summary> /// <param name="billingItem">The billing item.</param> /// <param name="quantity">The quantity.</param> public void AddItem(BillingItem billingItem, int quantity) { DataRow dr = this._tblItems.NewRow(); dr["Item"] = billingItem.Item; dr["ItemNo"] = billingItem.ItemNo; dr["Quantity"] = quantity; dr["Price"] = billingItem.Price; dr["PriceTotal"] = billingItem.Price * (double)quantity; this._tblItems.Rows.Add(dr); }
public static async Task <BillingItem> GetIAPBillingProductWithTypeAsync(EVeSubscriptionType type) { var product = new BillingItem(); try { var connected = await Billing.ConnectAsync(); if (!connected) { product.Message = "Error connecting to store. Check your connection and try again."; product.Success = false; } IEnumerable <InAppBillingProduct> items = null; switch (type) { case EVeSubscriptionType.Unknown: items = null; break; case EVeSubscriptionType.SingleSubscription: items = await Billing.GetProductInfoAsync(ItemType.Subscription, SingleSubscriptionProductID); break; case EVeSubscriptionType.AdditionalSubscription: items = await Billing.GetProductInfoAsync(ItemType.Subscription, AdditionalSubscriptionProductID); break; } if (items != null) { product.Product = items.FirstOrDefault(); product.Success = true; } else { product.Success = false; product.Message = "Unable to retrieve product information"; } } catch (InAppBillingPurchaseException purchaseEx) { //Billing Exception handle this based on the type product.Message = $"Error in {purchaseEx.Message}"; product.Success = false; } catch (Exception ex) { product.Message = $"Issue connecting: {ex.Message}"; product.Success = false; } finally { //Disconnect, it is okay if we never connected await Billing.DisconnectAsync(); } return(product); }
private void UpdateGrid(BillingItem item, bool updating) { if (updating) { int itemIndex = billingItems[item.AssociatedDate.Date.ToShortDateString()].IndexOf(item); billingItems[item.AssociatedDate.Date.ToShortDateString()][itemIndex] = item; } else { billingItems[(string)lbTimeEntries.Items[selectedListBoxIndex]].Add(item); } LoadData(); JobHandler.Instance.UpdateSavePending(true); }
private BillPrintItemViewModel Map(BillingItem billingItem) { var model = new BillPrintItemViewModel { BillingItemId = billingItem.BillingItemId, Price = billingItem.SellingPrice, CGST = billingItem.CGST, SGST = billingItem.SGST, Description = billingItem.Item.Description, Quantity = billingItem.Quantity, }; return(model); }
private void ProcessItem(object sender, EventArgs e) { if (e is ObjectCreatedEventArgs args) { BillingItem item = args.DataValue as BillingItem; bool isUpdating = (bool)args.Tag; if (item == null) { return; } UpdateGrid(item, isUpdating); } }
private BillingItemAudit Map(BillingItem billingItem) { return(new BillingItemAudit { BillingItemId = billingItem.BillingItemId, CGST = billingItem.CGST, SGST = billingItem.SGST, ItemId = billingItem.ItemId, OriginalPrice = billingItem.OriginalPrice, SellingPrice = billingItem.SellingPrice, Quantity = billingItem.Quantity, CreatedDate = DateTime.Now, BillId = billingItem.BillId }); }
internal bool UpdateBillingItem(BillingItem bi) { SqlCommand cmd = new SqlCommand("UpdateBillingItem"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Id", SqlDbType.Int).Value = bi.Id; cmd.Parameters.Add("@BookingId", SqlDbType.Int).Value = bi.BookingId; cmd.Parameters.Add("@CodeId", SqlDbType.Int).Value = bi.CodeId; cmd.Parameters.Add("@quantity", SqlDbType.Int).Value = 1; cmd.Parameters.Add("@Description", SqlDbType.NVarChar).Value = bi.Description; cmd.Parameters.Add("@BillingAmount", SqlDbType.Money).Value = bi.BillingAmount; cmd.Parameters.Add("@PayoutAmount", SqlDbType.Money).Value = bi.PayoutAmount; cmd.Parameters.Add("@VendorId", SqlDbType.Int).Value = bi.VendorId; return(base.ExecuteNonQuery(cmd) > 0); }
private BillingItem GetBillingItem(BillingItemCreateJsonModel viewModel) { var item = new BillingItem { CGST = viewModel.CGST, ItemId = viewModel.ItemId, OriginalPrice = viewModel.OriginalPrice, Quantity = viewModel.Quantity, SellingPrice = viewModel.SellingPrice, SGST = viewModel.SGST, TotalPrice = viewModel.TotalPrice, BillingItemId = viewModel.BillingItemId }; item.Item = _billingContext.GetItem(viewModel.ItemId); return(item); }
/// <summary> /// Set's the values of the controls to that of the specified billing item. /// </summary> /// <param name="item">The item to set the controls to.</param> private void SetControls(BillingItem item) { ResetControls(); radOfficeTime.Checked = item.OfficeTime != TimeSpan.Zero; radFieldTime.Checked = !radOfficeTime.Checked; if (radOfficeTime.Checked) { foreach (object o in cmbRates.Items) { if ((o as Rate).ID == item.OfficeRate.ID) { cmbRates.SelectedItem = o; } } } else { foreach (object o in cmbRates.Items) { if ((o as Rate).ID == item.FieldRate.ID) { cmbRates.SelectedItem = o; } } } rtbDescription.Text = item.Description; if (radOfficeTime.Checked) { DateTime d = dtpTimeEntry.Value; TimeSpan t = item.OfficeTime; dtpTimeEntry.Value = d.Date + t; } else { DateTime d = dtpTimeEntry.Value; TimeSpan t = item.FieldTime; dtpTimeEntry.Value = d.Date + t; } lblFormatBold.Text = $"{dtpTimeEntry.Value.Hour} hour(s) : {dtpTimeEntry.Value.Minute} minute(s) : {dtpTimeEntry.Value.Second} second(s)"; }
public NewEntryDlg(DateTime associatedDate, BillingItem oldItem = null, bool isEditing = false) { InitializeComponent(); this.associatedDate = associatedDate; this.oldItem = oldItem; this.isEditing = isEditing; if (this.oldItem != null) { isEditing = true; } if (isEditing) { Text = $"Editing Time Entry: {this.oldItem.ID} - {this.oldItem.AssociatedDate.Date.ToShortDateString()}"; } }
private BillingItemViewModel MapToBillingItemView(BillingItem billingItem, int index) { var gstAmt = billingItem.SellingPrice * (billingItem.CGST / 100); return(new BillingItemViewModel { BillingItemId = billingItem.BillingItemId, CGST = billingItem.CGST, SGST = billingItem.SGST, CGSTAmount = gstAmt, SGSTAmount = gstAmt, Description = _billingContext.GetItem(billingItem.ItemId).Description, ItemId = billingItem.ItemId, OriginalPrice = billingItem.OriginalPrice, SellingPrice = billingItem.SellingPrice, PerItemPrice = billingItem.SellingPrice + (gstAmt * 2), Items = _billingContext.GetAllItems().Select(Map).ToList(), TotalPrice = (billingItem.SellingPrice + (gstAmt * 2)) * billingItem.Quantity, Quantity = billingItem.Quantity, Index = index, }); }
async void ILabelButtonCancelPopupPage.DidTapButton(LabelButtonCancelPopupPage page, object output) { var subscriptionOption = output.ToString(); BillingItem billingItem = new BillingItem(); this.CustomActivityIndicator.IsRunning = true; if (subscriptionOption.ToLower() == StringSingleSubscription.ToLower()) { billingItem = await BillingManager.PurchaseProductWithTypeAsync(EVeSubscriptionType.SingleSubscription); if (billingItem.Success && await ViewModel.UserSingleSubscribe()) { await DisplayAlert("Success", $"Thank you for your support! You have been granted slideshow access", "Ok"); Title = ViewModel.InitialTitle; } else { await DisplayAlert("Error", $"Something went wrong, please try again later.", "Ok"); } } else if (subscriptionOption.ToLower() == StringAdditionalSubscription.ToLower()) { billingItem = await BillingManager.PurchaseProductWithTypeAsync(EVeSubscriptionType.AdditionalSubscription); if (billingItem.Success && await ViewModel.UserMultipleSubscribe()) { await DisplayAlert("Success", $"Thank you for your support! You have been granted multiple slideshow access", "Ok"); } else { await DisplayAlert("Error", $"Something went wrong, please try again later.", "Ok"); } } this.CustomActivityIndicator.IsRunning = false; }
/// <summary> /// Converts a list of billing items into a dictionary with the key being the date of the billing item and the value being a list /// of billing items for that date. /// </summary> public static Dictionary <string, List <BillingItem> > CreateDictionary(List <BillingItem> items) { Dictionary <string, List <BillingItem> > dict = new Dictionary <string, List <BillingItem> >(); List <BillingItem> itemsToAdd; bool[] addedItems = new bool[items.Count]; for (int i = 0; i < items.Count; i++) { itemsToAdd = new List <BillingItem>(); BillingItem item = items[i]; DateTime date = item.AssociatedDate; for (int j = 1; j < items.Count; j++) { BillingItem nextItem = items[j]; if (nextItem.AssociatedDate.Equals(date) & addedItems[j] == false) { addedItems[j] = true; itemsToAdd.Add(nextItem); } } if (addedItems[i] == false) { itemsToAdd.Add(item); addedItems[i] = true; } if (!dict.ContainsKey(date.Date.ToShortDateString())) { dict.Add(date.Date.ToShortDateString(), itemsToAdd); } } return(dict); }
public void AddBilling(BillingItem item) { items.Add(item); }
/// <summary> /// Recieve OnAddItem event. /// </summary> /// <param name="billingItem">The billing item.</param> /// <param name="quantity">The quantity.</param> private void biForm_OnAddItem(BillingItem billingItem, int quantity) { this._controller.AddItem(billingItem, quantity); this.btnCreateBill.Enabled = true; }