예제 #1
0
 private void FormFinanceCharges_Load(object sender, System.EventArgs e)
 {
     if (PIn.PDate(PrefB.GetString("DateLastAging")) < DateTime.Today)
     {
         if (MsgBox.Show(this, true, "You must update aging first."))              //OK
         {
             FormAging FormA = new FormAging();
             FormA.ShowDialog();
         }
         else
         {
             DialogResult = DialogResult.Cancel;
             return;
         }
     }
     if (PIn.PDate(PrefB.GetString("FinanceChargeLastRun")).AddDays(25) > DateTime.Today)
     {
         MessageBox.Show(Lan.g(this, "You cannot run finance charges again this month."));
         DialogResult = DialogResult.Cancel;
         return;
     }
     textAPR.MaxVal = 100;
     textAPR.MinVal = 0;
     FillList();
     textAPR.Text  = PrefB.GetString("FinanceChargeAPR");
     textDate.Text = DateTime.Today.ToShortDateString();
 }
예제 #2
0
 private void FormAging_Load(object sender, System.EventArgs e)
 {
     textDate.Text = (PIn.PDate(PrefB.GetString("DateLastAging"))).ToShortDateString();
     if (PIn.PDate(PrefB.GetString("DateLastAging")) < DateTime.Today)
     {
         if (MessageBox.Show(Lan.g(this, "Update aging first?"), "", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             FormAging FormA = new FormAging();
             FormA.ShowDialog();
             if (FormA.DialogResult == DialogResult.OK)
             {
                 textDate.Text = DateTime.Today.ToShortDateString();
             }
         }
     }
     for (int i = 0; i < DefB.Short[(int)DefCat.BillingTypes].Length; i++)
     {
         listBillType.Items.Add(DefB.Short[(int)DefCat.BillingTypes][i].ItemName);
     }
     listBillType.SelectedIndex = 0;
 }
예제 #3
0
 private void FormAging_Load(object sender, System.EventArgs e)
 {
     textDate.Text = (PIn.PDate(PrefB.GetString("DateLastAging"))).ToShortDateString();
     if (PIn.PDate(PrefB.GetString("DateLastAging")) < DateTime.Today)
     {
         if (MessageBox.Show(Lan.g(this, "Update aging first?"), "", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             FormAging FormA = new FormAging();
             FormA.ShowDialog();
             if (FormA.DialogResult == DialogResult.OK)
             {
                 textDate.Text = DateTime.Today.ToShortDateString();
             }
         }
     }
     for (int i = 0; i < DefB.Short[(int)DefCat.BillingTypes].Length; i++)
     {
         listBillType.Items.Add(DefB.Short[(int)DefCat.BillingTypes][i].ItemName);
     }
     if (listBillType.Items.Count > 0)
     {
         listBillType.SelectedIndex = 0;
     }
     listBillType.Visible      = false;
     checkBillTypesAll.Checked = true;
     for (int i = 0; i < Providers.List.Length; i++)
     {
         listProv.Items.Add(Providers.List[i].GetNameLF());
     }
     if (listProv.Items.Count > 0)
     {
         listProv.SelectedIndex = 0;
     }
     checkProvAll.Checked = true;
     listProv.Visible     = false;
 }
예제 #4
0
 //End of MiscTools, resume Tools.
 private void menuItemAging_Click(object sender, System.EventArgs e)
 {
     if(!Security.IsAuthorized(Permissions.Setup)){
         return;
     }
     FormAging FormAge=new FormAging();
     FormAge.ShowDialog();
     SecurityLogs.MakeLogEntry(Permissions.Setup,0,"Aging Update");
 }
예제 #5
0
        private void FormBillingOptions_Load(object sender, System.EventArgs e)
        {
            if (PIn.PDate(PrefB.GetString("DateLastAging")) < DateTime.Today)
            {
                if (MessageBox.Show(Lan.g(this, "Update aging first?"), "", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    FormAging FormA = new FormAging();
                    FormA.ShowDialog();
                }
            }
            for (int i = 0; i < DefB.Short[(int)DefCat.BillingTypes].Length; i++)
            {
                listBillType.Items.Add(DefB.Short[(int)DefCat.BillingTypes][i].ItemName);
            }
            textLastStatement.Text      = DateTime.Today.AddMonths(-1).ToShortDateString();
            checkIncludeChanged.Checked = PrefB.GetBool("BillingIncludeChanged");
            string[] selectedBillTypes = ((Pref)PrefB.HList["BillingSelectBillingTypes"]).ValueString.Split(',');
            for (int i = 0; i < selectedBillTypes.Length; i++)
            {
                try{
                    int order = DefB.GetOrder(DefCat.BillingTypes, Convert.ToInt32(selectedBillTypes[i]));
                    if (order != -1)
                    {
                        listBillType.SetSelected(order, true);
                    }
                }
                catch {}
            }
            if (listBillType.SelectedIndices.Count == 0)
            {
                listBillType.SelectedIndex = 0;
            }
            switch (((Pref)PrefB.HList["BillingAgeOfAccount"]).ValueString)
            {
            default:
                radioAny.Checked = true;
                break;

            case "30":
                radio30.Checked = true;
                break;

            case "60":
                radio60.Checked = true;
                break;

            case "90":
                radio90.Checked = true;
                break;
            }
            if (((Pref)PrefB.HList["BillingExcludeBadAddresses"]).ValueString == "1")
            {
                checkBadAddress.Checked = true;
            }
            if (((Pref)PrefB.HList["BillingExcludeInactive"]).ValueString == "1")
            {
                checkExcludeInactive.Checked = true;
            }
            if (((Pref)PrefB.HList["BillingExcludeNegative"]).ValueString == "1")
            {
                checkExcludeNegative.Checked = true;
            }
            textExcludeLessThan.Text = ((Pref)PrefB.HList["BillingExcludeLessThan"]).ValueString;
            //blank is allowed
            FillDunning();
        }
예제 #6
0
		private void butCreate_Click(object sender, System.EventArgs e) {
			if( textExcludeLessThan.errorProvider1.GetError(textExcludeLessThan)!=""
				|| textLastStatement.errorProvider1.GetError(textLastStatement)!=""
				|| textDateStart.errorProvider1.GetError(textDateStart)!=""
				|| textDateEnd.errorProvider1.GetError(textDateEnd)!=""
				)
			{
				MsgBox.Show(this,"Please fix data entry errors first.");
				return;
			}
			Ledgers.RunAging();
			if(PrefC.GetBool(PrefName.AgingCalculatedMonthlyInsteadOfDaily) && PrefC.GetDate(PrefName.DateLastAging) < DateTime.Today.AddDays(-15)) {
				MsgBox.Show(this,"Last aging date seems old, so you will now be given a chance to update it.  The billing process will continue whether or not aging gets updated.");
				FormAging FormA=new FormAging();
				FormA.ShowDialog();
			}
			DateTime lastStatement=PIn.Date(textLastStatement.Text);
			if(textLastStatement.Text=="") {
				lastStatement=DateTimeOD.Today;
			}
			string getAge="";
			if(comboAge.SelectedIndex==1) getAge="30";
			else if(comboAge.SelectedIndex==2) getAge="60";
			else if(comboAge.SelectedIndex==3) getAge="90";
			List<long> billingNums=new List<long>();//[listBillType.SelectedIndices.Count];
			for(int i=0;i<listBillType.SelectedIndices.Count;i++){
				if(listBillType.SelectedIndices[i]==0){//if (all) is selected, then ignore any other selections
					billingNums.Clear();
					break;
				}
				billingNums.Add(DefC.Short[(int)DefCat.BillingTypes][listBillType.SelectedIndices[i]-1].DefNum);
			}
			List<long> listClinicNums=new List<long>();
			if(!PrefC.GetBool(PrefName.EasyNoClinics)) {//Using clinics.
				if(comboClinic.SelectedIndex>1) {
					listClinicNums.Add(ListClinics[comboClinic.SelectedIndex-2].ClinicNum);
				}
				else {
					if(comboClinic.SelectedIndex==0) {//All
						for(int i=0;i<ListClinics.Count;i++) {
							listClinicNums.Add(ListClinics[i].ClinicNum);
						}
					}
					listClinicNums.Add(0);//Unassigned will always be used at this point.
				}
			}
			Cursor=Cursors.WaitCursor;
			List<PatAging> agingList=Patients.GetAgingList(getAge,lastStatement,billingNums,checkBadAddress.Checked,
				checkExcludeNegative.Checked,PIn.Double(textExcludeLessThan.Text),
				checkExcludeInactive.Checked,checkIncludeChanged.Checked,checkExcludeInsPending.Checked,
				checkExcludeIfProcs.Checked,checkIgnoreInPerson.Checked,listClinicNums);
			DateTime dateRangeFrom=DateTime.MinValue;
			DateTime dateRangeTo=DateTimeOD.Today;//Needed for payplan accuracy.//new DateTime(2200,1,1);
			if(textDateStart.Text!=""){
				dateRangeFrom=PIn.Date(textDateStart.Text);
			}
			if(textDateEnd.Text!=""){
				dateRangeTo=PIn.Date(textDateEnd.Text);
			}
			if(agingList.Count==0){
				Cursor=Cursors.Default;
				MsgBox.Show(this,"List of created bills is empty.");
				return;
			}
			//if(agingList!=null){
			Statement stmt;
			int ageAccount=0;
			YN insIsPending=YN.Unknown;
			Dunning dunning;
			Dunning[] dunList=Dunnings.Refresh();
			for(int i=0;i<agingList.Count;i++){
				stmt=new Statement();
				stmt.DateRangeFrom=dateRangeFrom;
				stmt.DateRangeTo=dateRangeTo;
				stmt.DateSent=DateTimeOD.Today;
				stmt.DocNum=0;
				stmt.HidePayment=false;
				stmt.Intermingled=checkIntermingled.Checked;
				stmt.IsSent=false;
				if(PrefC.GetString(PrefName.BillingUseElectronic)=="1"
					|| PrefC.GetString(PrefName.BillingUseElectronic)=="2"
 					|| PrefC.GetString(PrefName.BillingUseElectronic)=="3")
				{
					stmt.Mode_=StatementMode.Electronic;
					stmt.Intermingled=true;
				}
				else {
					stmt.Mode_=StatementMode.Mail;
				}
				if(DefC.GetDef(DefCat.BillingTypes,agingList[i].BillingType).ItemValue=="E"){
					stmt.Mode_=StatementMode.Email;
				}
				InstallmentPlan installPlan=InstallmentPlans.GetOneForFam(agingList[i].PatNum);
				if(installPlan==null) {
					stmt.Note=textNote.Text;
				}
				else {
					stmt.Note=textNote.Text.Replace("[InstallmentPlanTerms]",
						"Installment Plan\r\n"
					+"Date First Payment: "+installPlan.DateFirstPayment.ToShortDateString()+"\r\n"
					+"Monthly Payment: "+installPlan.MonthlyPayment.ToString("c")+"\r\n"
					+"APR: "+(installPlan.APR/(float)100).ToString("P")+"\r\n"
					+"Note: "+installPlan.Note);
				}
				stmt.NoteBold="";
				//appointment reminders are not handled here since it would be too slow.
				//set dunning messages here
				if(agingList[i].BalOver90>0){
					ageAccount=90;
				}
				else if(agingList[i].Bal_61_90>0){
					ageAccount=60;
				}
				else if(agingList[i].Bal_31_60>0){
					ageAccount=30;
				}
				else{
					ageAccount=0;
				}
				if(agingList[i].InsEst>0){
					insIsPending=YN.Yes;
				}
				else{
					insIsPending=YN.No;
				}
				dunning=Dunnings.GetDunning(dunList,agingList[i].BillingType,ageAccount,insIsPending);
				if(dunning!=null){
					if(stmt.Note!=""){
						stmt.Note+="\r\n\r\n";//leave one empty line
					}
					stmt.Note+=dunning.DunMessage;
					//if(stmt.Note!=""){//there will never be anything in NoteBold already
					//	stmt.Note+="\r\n\r\n";//leave one empty line
					//}
					stmt.NoteBold+=dunning.MessageBold;
					stmt.EmailSubject=dunning.EmailSubject;					
					stmt.EmailBody=dunning.EmailBody;
				}
				stmt.PatNum=agingList[i].PatNum;
				stmt.SinglePatient=false;
				Statements.Insert(stmt);
			}
			DialogResult=DialogResult.OK;
		}