/// <summary> /// Populates the data. /// </summary> void PopulateData() { IBilling BillingManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.Billing.BBilling, BusinessProcess.Billing"); // int? _patientID = null; DateTime?_dateFrom = null; DateTime?_dateTo = null; if (ckbTodaysBills.Checked) { _dateFrom = DateTime.Today; _dateTo = DateTime.Today.AddDays(1).AddMilliseconds(-1); } DataTable dt = BillingManager.GetPatientWithUnpaidItems(this.LocationId, _dateFrom, _dateTo); dt.DefaultView.Sort = "BillDate Desc"; //if (ckbTodaysBills.Checked) //{ // DataView dv = dt.DefaultView; // dv.RowFilter = "BillDate = '" + DateTime.Today + "'"; // DataTable theDT = dv.ToTable(); // grdPatienBill.DataSource = theDT; //} //else //{ grdPatienBill.DataSource = dt.DefaultView; // } grdPatienBill.DataBind(); }
/// <summary> /// Init_pages this instance. /// </summary> private void Init_page() { try { IBilling BManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.SCM.BBilling, BusinessProcess.SCM"); DataTable dtBill = BManager.GetBillDetails(this.BillID); lblTotalBill.InnerText = dtBill.Rows[0]["BillAmount"].ToString(); this.AmountDue = Convert.ToDecimal(dtBill.Rows[0]["UnpaidAmount"].ToString()); if (this.AmountDue == 0) { string theUrl = "./frmBillingFindAddBill.aspx"; Response.Redirect(theUrl, false); } this.BillAmount = Convert.ToDecimal(dtBill.Rows[0]["BillAmount"].ToString()); labelAmountDue.InnerText = textAmountToPay.Text = this.AmountDue.ToString(); this.rgAmountToPay.MaximumValue = this.AmountDue.ToString(); this.rgAmountToPay.MinimumValue = "0"; this.rgAmountToPay.ErrorMessage = string.Format("The value should be between 0 and {0}", this.AmountDue); this.PopulateBillItems(); this.PopulateBillTransactions(); this.PopulatePaymentMode(); this.PopulatePatientDetails(); tblCompute.Visible = true; tblFinish.Visible = false; buttonCompute.Enabled = false; } catch (Exception ex) { this.showErrorMessage(ref ex); } }
/// <summary> /// Validates the specified bill payment information. /// </summary> /// <exception cref="System.NotImplementedException"></exception> /// <exception cref="System.NotImplementedException"></exception> public void Validate() { if (this.PaymentMethodName.ToLower().Trim() == "deposit") { IBilling bMrg = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.SCM.BBilling,BusinessProcess.SCM"); DataTable dtDeposit = bMrg.GetPatientDeposit(this.PatientID, this.BillLocationID); if (dtDeposit.Rows.Count > 0 && Convert.ToDecimal(dtDeposit.Rows[0]["AvailableAmount"]) > 0.0M) { decimal availableDeposit = Convert.ToDecimal(dtDeposit.Rows[0]["AvailableAmount"]); this.ValidateDeposit(availableDeposit); labelAmountTendered.InnerText = "Available Deposit"; } else { panelDeposit.Visible = false; NotifyAction("The client has no available deposit", "Patient Deposits", true); buttonCompute.Visible = btnFinish.Visible = false; } } else if (this.PaymentMethodName.ToLower().Trim() == "cash") { this.ValidateCash(); } else //if (this.PaymentMethodName.ToLower().Trim() == "nhif") { this.ValidateOthers(); } }
/// <summary> /// Populates the payment methods. /// </summary> void PopulatePaymentMethods(string selectedValue = "") { try { if (ddlPaymentMode.Items.Count < 2) { IBilling bMGr = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.Billing.BBilling, BusinessProcess.Billing"); List <PaymentMethod> paymentMethods = bMGr.GetPaymentMethods(""); foreach (PaymentMethod me in paymentMethods) { ddlPaymentMode.Items.Add(new ListItem(me.Name, me.Id.Value.ToString())); } if (ddlPaymentMode.Items.Count > 1) { ddlPaymentMode.Items.Insert(0, new ListItem("Select...", "")); } } if (selectedValue != "") { ddlPaymentMode.Items.FindByValue(selectedValue).Selected = true; } } catch (Exception ex) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = ex.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); } }
/// <summary> /// Init_pages this instance. /// </summary> private void init_page() { IBilling BManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.Billing.BBilling, BusinessProcess.Billing"); this.rptDocument = new ReportDocument(); DataSet theDataSet; theDataSet = BManager.GetInvoice(Convert.ToInt32(Request.QueryString["BillRefCode"]), Convert.ToInt32(Session["AppLocationId"]), this.PatientId); theDataSet.Tables[0].TableName = "Command_3"; theDataSet.Tables[1].TableName = "Command_2"; theDataSet.Tables[2].TableName = "Command_1"; theDataSet.Tables[3].TableName = "Command"; rptDocument.Load(MapPath("..\\Billing\\Reports\\rptInvoice.rpt")); rptDocument.SetDataSource(theDataSet); rptDocument.SetParameterValue("Currency", "KES"); rptDocument.SetParameterValue("userName", Session["AppUserName"]); String facilityName = (String)theDataSet.Tables[1].Rows[0]["FacilityName"]; rptDocument.SetParameterValue("FacilityName", facilityName); String facilityLogo = (String)theDataSet.Tables[1].Rows[0]["FacilityLogo"]; rptDocument.SetParameterValue("PicturePath", GblIQCare.GetPath() + facilityLogo); billingRptViewer.EnableParameterPrompt = false; billingRptViewer.ReportSource = rptDocument; billingRptViewer.HasToggleGroupTreeButton = false; billingRptViewer.DataBind(); }
/// <summary> /// Populates the type of the payment. /// </summary> void PopulatePaymentType() { IBilling BillingManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.SCM.BBilling, BusinessProcess.SCM"); List <PaymentMethod> paymentMethods = BillingManager.GetPaymentMethods(""); PaymentConfigHelper.RefreshSection(); if (paymentMethods != null) { int i = 0; for (i = 0; i < paymentMethods.Count(); i++)//PaymentMethod e in paymentMethods) { PaymentMethod e = paymentMethods[i]; string name = e.Name; if (PaymentConfigHelper.PaymethodExists(name)) { try { string _thishandler = PaymentConfigHelper.GetHandlerNameByPayMethod(name); e.MethodDescription = PaymentConfigHelper.PayElementDescription(name); if (!string.IsNullOrEmpty(_thishandler)) { e.Handler = _thishandler; e.HandlerDescription = PaymentConfigHelper.HandlerDescription(_thishandler); e.ControlName = PaymentConfigHelper.HandlerControlName(_thishandler); } } catch { } } } gridPaymentType.DataSource = paymentMethods; gridPaymentType.DataBind(); } }
protected void lnkSummaryReport_Click(object sender, EventArgs e) { IBilling BillingManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.Billing.BBilling, BusinessProcess.Billing"); DataSet theDS = BillingManager.getCashiersTransactionSummary(Convert.ToInt32(base.Session["AppUserId"])); DataTable theDt = theDS.Tables[0]; DataTable refundsDt = theDS.Tables[1]; Decimal refunds = 0; if (refundsDt.Rows.Count > 0) { refunds = (Decimal)refundsDt.Rows[0][0]; } Decimal transactions = 0; Decimal collections = 0; Decimal cashcollections = 0; if (theDt.Rows.Count > 0) { transactions = Convert.ToDecimal(theDt.Compute("Sum(TotalTransactions)", "")); collections = Convert.ToDecimal(theDt.Compute("Sum(Total)", "")); cashcollections = Convert.ToDecimal(theDt.Compute("Sum(Total)", "PaymentName= 'Cash' OR PaymentName='Deposit'")); } Decimal cashInHand = cashcollections - refunds; lblTotalTransactions.Text = transactions.ToString(); lblTotalCollections.Text = collections.ToString(); lblRefunds.Text = refunds.ToString(); lblCash.Text = cashInHand.ToString(); gridTransaction.DataSource = theDt; gridTransaction.DataBind(); transactionsSummaryPopup.Show(); }
/// <summary> /// Populates the bill transactions. /// </summary> void PopulateBillTransactions() { IBilling BManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.SCM.BBilling, BusinessProcess.SCM"); DataTable dtTransaction = BManager.GetBillTransactions(BillID); gridBillTransaction.DataSource = dtTransaction; gridBillTransaction.DataBind(); }
public PhoneOperator(int dayInterval = 100000) { dtHelper = new DateTimeHelper(dayInterval); IPortFactory pFactory = new PePortFactory(); ape = new PhoneExchange(pFactory, (new IntId()).StartValue()); Billing = new Billing(ape, new ContractFactory(dtHelper), new SubscriberFactory(), dtHelper); }
/// <summary> /// Populates the bill items. /// </summary> void PopulateBillItems() { IBilling BManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.SCM.BBilling, BusinessProcess.SCM"); DataTable dtItems = BManager.GetBillItems(this.BillID); grdPayItems.Columns[4].FooterText = "Total: " + this.BillAmount.ToString("N"); grdPayItems.DataSource = dtItems; grdPayItems.DataBind(); }
static List <DiscountPlan> GetDiscountPlans(int payMethodID) { List <DiscountPlan> plans = new List <DiscountPlan>(); IBilling bMGr = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.Billing.BBilling,BusinessProcess.Billing"); plans = bMGr.GetDiscountPlans(null, payMethodID, DateTime.Today, true); return(plans); }
public static void CallCommit(CallInfo callInfo, IBilling billing) { billing.CommitCall(callInfo); ISubscriber subscriber = billing.GetSubscriberBy(callInfo.SourcePhoneNumber); ISubscriber targetSubscriber = billing.GetSubscriberBy(callInfo.TargetPhoneNumber); subscriber.Port.State = PortState.Free; targetSubscriber.Port.State = PortState.Free; }
public Company(string name, IBilling billing, IBaseStation baseStation) { Name = name; Clients = new List <IClient>(); Contracts = new List <IContract>(); Billing = billing; BaseStation = baseStation; SubscribeToEvents(); // company automaticaly subscribes for notifications }
/// <summary> /// Populates the type of the payment. /// </summary> void PopulatePaymentType() { IBilling BillingManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.Billing.BBilling, BusinessProcess.Billing"); List <PaymentMethod> paymentMethods = BillingManager.GetPaymentMethods(""); gridPaymentType.DataSource = paymentMethods; gridPaymentType.DataBind(); }
public void Checkout(IBilling billing) { if (billing == null) { throw new NullReferenceException(); } billing.Pay(Basket.TotalCost); //ResetCart(); }
/// <summary> /// Handles the Click event of the buttonSubmit control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void buttonSubmit_Click(object sender, EventArgs e) { string paymentName = textPaymentTypeName.Text; if (textPaymentTypeName.Text == "") { this.NotifyAction("Name of the payment method is required", "Validation", true); this.paymentTypePopup.Show(); return; } string pluginName = "PayBillCorporate.ascx";// ddlHandler.SelectedItem.Value; if (buttonSubmit.CommandName == "UPDATE") { pluginName = CurrentPlugin; } try { IBilling BillingManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.Billing.BBilling, BusinessProcess.Billing"); PaymentMethod thisMethod = new PaymentMethod() { Name = paymentName, Locked = false, Active = rblStatus.SelectedValue == "1", MethodDescription = textDescription.Text, Credit = true, ControlName = pluginName }; if (buttonSubmit.CommandName == "UPDATE") { thisMethod.Id = Convert.ToInt32(this.CurrentPayMethodId); } BillingManager.SavePaymentMethod(thisMethod, this.UserId); if (buttonSubmit.CommandName == "NEW") { this.NotifyAction("New payment method addedd successfully", string.Format("{0} {1} ", "Adding Payment method", paymentName), false); } else { this.NotifyAction("Payment method updated successfully", string.Format("{0} {1} ", "Updating Payment method", paymentName), false); } this.PopulatePaymentType(); return; } catch (Exception ex) { this.NotifyAction(ex.Message.ToString(), "Error Occured", true); return; } }
/// <summary> /// Handles the ExecutePayment event of the payBillControl control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="CommandEventArgs"/> instance containing the event data.</param> void payBillControl_ExecutePayment(object sender, CommandEventArgs e) { // Hashtable payObject = e.CommandArgument as Hashtable; BillPaymentInfo paymentInfo = (BillPaymentInfo)e.CommandArgument; List <BillItem> items = (List <BillItem>)paymentInfo.ItemsToPay;//["PayItems"]; try { IBilling BManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.Billing.BBilling, BusinessProcess.Billing"); //DataTable table Receipt receipt = BManager.SavePatientBillPayments(this.PatientId, paymentInfo, this.UserId); //BManager.SavePatientBillPayments(this.PatientID, paymentInfo, null, this.UserID); bool printReceipt = paymentInfo.PrintReceipt;// Convert.ToBoolean(paymentInfo.Rows[0]["PrintReceipt"]); // Session["transactionID"] = transactionID; //Reciept print string theUrl; base.Session.Remove("ItemsToPay"); base.Session.Remove("paymentInformation"); base.Session.Remove("DiscountPlan"); base.Session.Remove("totalbill"); // DataRow row = table.Rows[0]; string transactionID = receipt.TransactionId.ToString(); // row["TransactionID"].ToString(); string transactionRef = receipt.ReceiptNumber; // row["TransactionReference"].ToString(); ((IPayment)sender).Clear(); if (printReceipt) { // base.Session["TransactionReceipt"] = receipt; theUrl = string.Format("./frmBilling_Reciept.aspx?ReceiptTrxCode={0}&RePrint=false", transactionRef); string theOrdScript; theOrdScript = "<script language='javascript' id='PrintReciept'>\n"; theOrdScript += "window.open('" + theUrl + "','Receipt','toolbars=no,location=no,directories=no,dependent=yes,top=100,left=30,maximize=no,resize=no,width=1000,height=800,scrollbars=yes');\n"; // theOrdScript += "window.location.href = './frmBilling_ClientBill.aspx';\n"; theOrdScript += "</script>\n"; // Page.ClientScript.RegisterStartupScript(this.GetType(), "PrintReciept", theOrdScript); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "PrintReceipt", theOrdScript, false); } // this.DisplayMode("ITEMS"); this.PopulateBillTransactions(); UpdatePanel1.Update(); upBill.Update(); Session.Remove("PayControl"); this.Init_page(); } catch (Exception ex) { ((IPayment)sender).Clear(); this.showErrorMessage(ref ex); } }
public virtual bool ChangeTariff(IBilling billing, ITariff newTariff) { bool res = newTariff != null && (_dtHelper.Now - TariffStartDate).Days >= _daysToChangeContract && billing.Balance(this) >= 0; if (res) { Tariff = newTariff; TariffStartDate = _dtHelper.Now; } return(res); }
/// <summary> /// Populates the bill items. /// </summary> void PopulateBillItems() { IBilling BManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.SCM.BBilling, BusinessProcess.SCM"); DataTable dtItems = BManager.GetBillItems(this.BillID); DataView theDV = new DataView(dtItems); theDV.RowFilter = "PaymentStatus=0"; grdPayItems.DataSource = theDV.ToTable(); grdPayItems.DataBind(); }
public void Checkout(IBilling billing) { if (billing != null) { billing.Pay(billing.CalcOrder(_cart, _shipping)); } else { throw new NullReferenceException(); } }
public void NotEnoughCashShouldThrowException() { webshop = new MyWebshop(basket = new Basket()); Product p = new Product() { Price = 10.00m }; webshop.Basket.AddProduct(p, 2); Assert.Throws <NotEnoughCashException>(() => webshop.Checkout(billing = new MockBilling(19.00m)), "You should not have enough cash"); }
///// <summary> ///// Loads the open bills. ///// </summary> //private void LoadOpenBills() //{ // IBilling BillingManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.SCM.BBilling, BusinessProcess.SCM"); // grdPatienBill.DataSource = null; // DataSet theDS = BillingManager.GetOpenBills("", this.LocationID); // grdPatienBill.DataSource = theDS.Tables[0]; // grdPatienBill.DataBind(); //} /// <summary> /// Populates the data. /// </summary> void PopulateData() { IBilling BillingManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.SCM.BBilling, BusinessProcess.SCM"); // int? _patientID = null; DateTime?_dateFrom = null; DateTime?_dateTo = null; DataTable dt = BillingManager.GetPatientWithUnpaidItems(this.LocationID, _dateFrom, _dateTo); grdPatienBill.DataSource = dt; grdPatienBill.DataBind(); }
public void Checkout(IBilling billing) { if (billing != null) { _billing = billing; _billing.Pay(_basket.TotalCost); } else { throw new WrongBillingException(); } }
public void TooLittleOnBalanceShouldThrowException() { webshop = new YarnWebshop(basket = new Basket()); Product p = new Product() { Price = 295.00m }; webshop.Basket.AddProduct(p, 4); var newbalance = billing.Balance; Assert.Throws <InsufficientFundsException>(() => webshop.Checkout(billing = new MockBilling(600m)), "Money should not be sufficient"); }
private void DoBalanceNotify(IBilling billing) { if (billing == null) { return; } Stopwatch timeWatcher = new Stopwatch(); var clients = ClientManager.ClientManager.GetManager().GetClients(); IClient client = null; timeWatcher.Start(); foreach (var item in clients) { if (item.IDBilling == billing.ID) { client = item; break; } } timeWatcher.Stop(); if (timeWatcher.ElapsedMilliseconds > 500) { GlobalLogManager.WriteString("Warning: ClientsBountyManager. Поиск клиента по IDBilling более 500 мс."); } if (client == null) { GlobalLogManager.WriteString("Error: ClientsBountyManager. Не найден клиент со счетом ID = {0}, Account = {1}", billing.ID, billing.Account); return; } string number = ClientManager.ClientManager.GetManager().GetDefaultPhone(client.ID); if (!string.IsNullOrWhiteSpace(number)) { if (_param.NeedMakeBalanceNotifyCall) { CallManagementInterface.StartAutoinformator(number, _param.BalanceNotifyMessage, 0); } if (_param.NeedSendBalanceNotifySMS) { CallManagementInterface.SendSMS(number, _param.BalanceNotifyMessage, 0); } } else { GlobalLogManager.WriteString("Warning: ClientsBountyManager. У клиента не указан номер телефона"); } }
public void AllValidCheckoutShouldBeSuccessful() { webshop = new YarnWebshop(basket = new Basket()); Product p = new Product() { Price = 295.00m }; webshop.Basket.AddProduct(p, 4); webshop.Checkout(billing = new MockBilling(1180m)); var newbalance = billing.Balance; Assert.AreEqual(0, newbalance, "Money should cover billing"); }
/// <summary> /// Populates the bill transactions. /// </summary> void PopulateBillTransactions() { IBilling BManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.SCM.BBilling, BusinessProcess.SCM"); DataTable dtTransaction = BManager.GetBillTransactions(BillID); gridBillTransaction.DataSource = dtTransaction; gridBillTransaction.DataBind(); //buttonPrintReceipt.Enabled = false; //if (dtTransaction.Rows.Count > 0) //{ // string theUrl = "./frmBilling_Reciept.aspx"; // buttonPrintReceipt.OnClientClick = "openReportPage('" + theUrl + "'); return false;"; // buttonPrintReceipt.Enabled = true; //} }
private void btnSave_Click(object sender, EventArgs e) { DataTable theDT = ((DataTable)bs_ItemCost.DataSource).GetChanges(); if (theDT != null) { IBilling objProgramlist = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.SCM.BBilling, BusinessProcess.SCM"); int i = objProgramlist.SavePriceList(theDT, GblIQCare.AppUserId); if (i < 1) { return; } loadData((int)ddlItemType.SelectedValue); MessageBox.Show("Saved Successfully.", "IQCare", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void EnoughCashShouldSucceed() { webshop = new MyWebshop(basket = new Basket()); Product p = new Product() { Price = 10.00m }; webshop.Basket.AddProduct(p, 2); webshop.Checkout(billing = new MockBilling(21.00m)); var currentBalance = billing.Balance; Assert.AreEqual(1.00m, currentBalance, "You should have enough cash"); }
/// <summary> /// Populates the discount plans. /// </summary> void PopulateDiscountPlans() { try { IBilling bMGr = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.Billing.BBilling, BusinessProcess.Billing"); List <DiscountPlan> _plans = bMGr.GetDiscountPlans(null, null, null, true); gridDiscountPlan.DataSource = _plans; gridDiscountPlan.DataBind(); } catch (Exception ex) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = ex.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); } }