コード例 #1
0
		/// <summary>
		/// Where the actual allocation occurs.  Put it in this method so that we could run the allocator in different 
		/// circumstances.
		/// </summary>
		/// <param name="iGuarantor"></param>
		private static void _AllocateExecute(long iGuarantor) {
			OpenDental.Reporting.Allocators.MyAllocator1.GuarantorLedgerItemsCollection Ledger =
								new OpenDental.Reporting.Allocators.MyAllocator1.GuarantorLedgerItemsCollection(iGuarantor);
			Ledger.Fill(false);
			Ledger.EqualizePaymentsV2();

		}
コード例 #2
0
		/// <summary>
		/// The method that actually calls the Equalizer.  Currently the equalizer just equalizes this instances
		/// data so that we can see the data via the returned DataTable
		/// 
		/// Note this Erases the old ledger item and replaces it with a new one for the Specified Guarantor
		/// </summary>
		/// <param name="uGuarantor"></param>
		/// <returns></returns>
		public DataTable EqualizeGuarantorPayments(int iGuarantor)
		{
			this.Ledger = new GuarantorLedgerItemsCollection(iGuarantor);

			Ledger.Fill(false);
			// Old call need to keep to figure out what I was thinking before
			//Ledger.FillFromDansLedgerOriginalTable(openConnection);
			Ledger.EqualizePaymentsV2();

			Ledger.FullLedger.Sort();
		//	int c2 = Ledger.FullLedger[0].CompareTo(Ledger.FullLedger[1]);

			DataTable dt = new DataTable();
			string[] cols = { "Item Date", "Patient", "Guarantor", "ItemType", 
							  "Provider",  "Charge",  "Payment",   "Balance" };
			foreach (string s in cols)
				dt.Columns.Add(new DataColumn(s));

			//GuarantorLedgerItemsCollection MixedCollection = new GuarantorLedgerItemsCollection(
			decimal runningBalance = 0;
			decimal runningCharges = 0;
			decimal runningPayments = 0;
			DateTime CurDate = DateTime.MinValue;
			foreach (PP_LedgerItem li in Ledger.FullLedger)
			{
				if (!(li is PP_PaymentItem))
				{
					runningBalance += li.AMMOUNT;
					runningCharges += li.AMMOUNT;
					DataRow dr = dt.NewRow();
					//string s3 = li.ITEMDATE.ToShortDateString();
					if (li.ITEMDATE > CurDate)
					{
						CurDate = li.ITEMDATE;
						dr[0] = li.ITEMDATE.ToShortDateString();
						if (dt.Rows.Count > 0)
							dt.Rows[dt.Rows.Count - 1][7] = runningBalance.ToString();
					}
					else
						dr[0] = "";
					dr[1] = li.PATNUM.ToString();
					dr[2] = li.GUARANTOR.ToString();
					dr[3] = ((MyAllocator1.LedgerItemTypes)li.ITEMTYPE).ToString();
					dr[4] = li.PROVNUM.ToString();
					dr[5] = li.AMMOUNT.ToString();
					dr[6] = ""; //Payment Column
					dt.Rows.Add(dr);

				}
				else
				{
					PP_PaymentItem payitem = (PP_PaymentItem)li;
					foreach (PP_PaySplitItem psi in payitem.PAYMENT_SPLITS)
					{
						runningBalance += psi.AMMOUNT;
						runningPayments += psi.AMMOUNT;
						DataRow dr = dt.NewRow();
						if (li.ITEMDATE > CurDate)
						{
							CurDate = payitem.ITEMDATE;
							dr[0] = payitem.ITEMDATE.ToShortDateString();
							if (dt.Rows.Count > 0)
								dt.Rows[dt.Rows.Count - 1][7] = runningBalance.ToString();
						}
						else
							dr[0] = "";
						dr[1] = payitem.PATNUM.ToString();
						dr[2] = payitem.GUARANTOR.ToString();
						dr[3] = ((MyAllocator1.LedgerItemTypes)payitem.ITEMTYPE).ToString();
						dr[4] = psi.PROVNUM.ToString();
						dr[5] = ""; // Charge Column
						dr[6] = psi.AMMOUNT.ToString();
						dt.Rows.Add(dr);

					}
				}
			}
			if (dt.Rows.Count > 0)
				dt.Rows[dt.Rows.Count - 1][7] = runningBalance.ToString();
			{
				dt.Rows.Add(dt.NewRow()); // blank line
				DataRow dr = dt.NewRow();
				dr[0] = CurDate.ToShortDateString();
				dr[4] = "Totals";
				dr[5] = runningCharges.ToString();
				dr[6] = runningPayments.ToString();
				dr[7] = runningBalance.ToString();
				dt.Rows.Add(dr);
			}
			return dt;
		}
コード例 #3
0
 /// <summary>
 /// Where the actual allocation occurs.  Put it in this method so that we could run the allocator in different
 /// circumstances.
 /// </summary>
 /// <param name="iGuarantor"></param>
 private static void _AllocateExecute(long iGuarantor)
 {
     OpenDental.Reporting.Allocators.MyAllocator1.GuarantorLedgerItemsCollection Ledger =
         new OpenDental.Reporting.Allocators.MyAllocator1.GuarantorLedgerItemsCollection(iGuarantor);
     Ledger.Fill(false);
     Ledger.EqualizePaymentsV2();
 }