示例#1
0
        ///<summary>Used in the Plan edit window to get a list of benefits for specified plan and patPlan.  patPlanNum can be 0.</summary>
        public static List <Benefit> RefreshForPlan(int planNum, int patPlanNum)
        {
            string command = "SELECT *" //,IFNULL(covcat.CovCatNum,0) AS covorder "
                             + " FROM benefit"
                                        //+" LEFT JOIN covcat ON covcat.CovCatNum=benefit.CovCatNum"
                             + " WHERE PlanNum = " + POut.PInt(planNum);

            if (patPlanNum != 0)
            {
                command += " OR PatPlanNum = " + POut.PInt(patPlanNum);
            }
            DataTable      table  = General.GetTable(command);
            List <Benefit> retVal = new List <Benefit>();
            Benefit        ben;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                ben                   = new Benefit();
                ben.BenefitNum        = PIn.PInt(table.Rows[i][0].ToString());
                ben.PlanNum           = PIn.PInt(table.Rows[i][1].ToString());
                ben.PatPlanNum        = PIn.PInt(table.Rows[i][2].ToString());
                ben.CovCatNum         = PIn.PInt(table.Rows[i][3].ToString());
                ben.OldCode           = PIn.PString(table.Rows[i][4].ToString());
                ben.BenefitType       = (InsBenefitType)PIn.PInt(table.Rows[i][5].ToString());
                ben.Percent           = PIn.PInt(table.Rows[i][6].ToString());
                ben.MonetaryAmt       = PIn.PDouble(table.Rows[i][7].ToString());
                ben.TimePeriod        = (BenefitTimePeriod)PIn.PInt(table.Rows[i][8].ToString());
                ben.QuantityQualifier = (BenefitQuantity)PIn.PInt(table.Rows[i][9].ToString());
                ben.Quantity          = PIn.PInt(table.Rows[i][10].ToString());
                ben.CodeNum           = PIn.PInt(table.Rows[i][11].ToString());
                ben.CoverageLevel     = (BenefitCoverageLevel)PIn.PInt(table.Rows[i][12].ToString());
                retVal.Add(ben);
            }
            return(retVal);
        }
示例#2
0
        ///<summary></summary>
        public static TimeAdjust[] Refresh(int empNum, DateTime fromDate, DateTime toDate)
        {
            string command =
                "SELECT * from timeadjust WHERE"
                + " EmployeeNum = '" + POut.PInt(empNum) + "'"
                + " AND TimeEntry >= " + POut.PDate(fromDate)
                //adding a day takes it to midnight of the specified toDate
                + " AND TimeEntry <= " + POut.PDate(toDate.AddDays(1));

            command += " ORDER BY TimeEntry";
            DataTable table = General.GetTable(command);

            TimeAdjust[] List = new TimeAdjust[table.Rows.Count];
            for (int i = 0; i < List.Length; i++)
            {
                List[i] = new TimeAdjust();
                List[i].TimeAdjustNum = PIn.PInt(table.Rows[i][0].ToString());
                List[i].EmployeeNum   = PIn.PInt(table.Rows[i][1].ToString());
                List[i].TimeEntry     = PIn.PDateT(table.Rows[i][2].ToString());
                List[i].RegHours      = TimeSpan.FromHours(PIn.PDouble(table.Rows[i][3].ToString()));
                List[i].OTimeHours    = TimeSpan.FromHours(PIn.PDouble(table.Rows[i][4].ToString()));
                List[i].Note          = PIn.PString(table.Rows[i][5].ToString());
            }
            return(List);
        }
        private void butAdd_Click(object sender, EventArgs e)
        {
            PaySplit PaySplitCur = new PaySplit();

            PaySplitCur.PayNum   = PaymentCur.PayNum;
            PaySplitCur.DatePay  = PIn.PDate(textDate.Text);         //this may be updated upon closing
            PaySplitCur.ProcDate = PIn.PDate(textDate.Text);         //this may be updated upon closing
            if (gridBal.GetSelectedIndex() == -1)
            {
                PaySplitCur.ProvNum = Patients.GetProvNum(PatCur);
            }
            else
            {
                PaySplitCur.ProvNum  = PIn.PInt(tableBalances.Rows[gridBal.GetSelectedIndex()]["ProvNum"].ToString());
                PaySplitCur.SplitAmt = -PIn.PDouble(tableBalances.Rows[gridBal.GetSelectedIndex()]["StartBal"].ToString());
            }
            PaySplitCur.PatNum = PatCur.PatNum;
            FormPaySplitEdit FormPS = new FormPaySplitEdit(FamCur);

            FormPS.PaySplitCur = PaySplitCur;
            FormPS.IsNew       = true;
            double total = 0;

            for (int i = 0; i < SplitList.Count; i++)
            {
                total += SplitList[i].SplitAmt;
            }
            FormPS.Remain = PaymentCur.PayAmt - total;
            if (FormPS.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            SplitList.Add(PaySplitCur);
            FillMain();
        }
示例#4
0
        private static List <PaySplit> RefreshAndFill(string command)
        {
            DataTable       table  = General.GetTable(command);
            List <PaySplit> retVal = new List <PaySplit>();
            PaySplit        split;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                split          = new PaySplit();
                split.SplitNum = PIn.PInt(table.Rows[i][0].ToString());
                split.SplitAmt = PIn.PDouble(table.Rows[i][1].ToString());
                split.PatNum   = PIn.PInt(table.Rows[i][2].ToString());
                split.ProcDate = PIn.PDate(table.Rows[i][3].ToString());
                split.PayNum   = PIn.PInt(table.Rows[i][4].ToString());
                //List[i].IsDiscount  = PIn.PBool  (table.Rows[i][5].ToString());
                //List[i].DiscountType= PIn.PInt   (table.Rows[i][6].ToString());
                split.ProvNum    = PIn.PInt(table.Rows[i][7].ToString());
                split.PayPlanNum = PIn.PInt(table.Rows[i][8].ToString());
                split.DatePay    = PIn.PDate(table.Rows[i][9].ToString());
                split.ProcNum    = PIn.PInt(table.Rows[i][10].ToString());
                split.DateEntry  = PIn.PDate(table.Rows[i][11].ToString());
                retVal.Add(split);
            }
            return(retVal);
        }
示例#5
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     try {
         TimeAdjustCur.TimeEntry = DateTime.Parse(textTimeEntry.Text);
     }
     catch {
         MsgBox.Show(this, "Please enter a valid date and time.");
         return;
     }
     if (textHours.errorProvider1.GetError(textHours) != "")
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (checkOvertime.Checked)
     {
         TimeAdjustCur.RegHours   = TimeSpan.FromHours(-PIn.PDouble(textHours.Text));
         TimeAdjustCur.OTimeHours = TimeSpan.FromHours(PIn.PDouble(textHours.Text));
     }
     else
     {
         TimeAdjustCur.RegHours   = TimeSpan.FromHours(PIn.PDouble(textHours.Text));
         TimeAdjustCur.OTimeHours = TimeSpan.FromHours(0);
     }
     TimeAdjustCur.Note = textNote.Text;
     if (IsNew)
     {
         TimeAdjusts.Insert(TimeAdjustCur);
     }
     else
     {
         TimeAdjusts.Update(TimeAdjustCur);
     }
     DialogResult = DialogResult.OK;
 }
示例#6
0
        ///<summary>Gets the balance of an account directly from the database.</summary>
        public static double GetBalance(int accountNum, AccountType acctType)
        {
            string command = "SELECT SUM(DebitAmt),SUM(CreditAmt) FROM journalentry "
                             + "WHERE AccountNum=" + POut.PInt(accountNum)
                             + " GROUP BY AccountNum";
            DataTable table  = General.GetTable(command);
            double    debit  = 0;
            double    credit = 0;

            if (table.Rows.Count > 0)
            {
                debit  = PIn.PDouble(table.Rows[0][0].ToString());
                credit = PIn.PDouble(table.Rows[0][1].ToString());
            }
            if (DebitIsPos(acctType))
            {
                return(debit - credit);
            }
            else
            {
                return(credit - debit);
            }

            /*}
             * catch {
             *      Debug.WriteLine(command);
             *      MessageBox.Show(command);
             * }
             * return 0;*/
        }
示例#7
0
        ///<summary>If trying to change the amount and attached to a deposit, it will throw an error, so surround with try catch.</summary>
        public static void Update(ClaimPayment cp)
        {
            string command = "SELECT DepositNum,CheckAmt FROM claimpayment "
                             + "WHERE ClaimPaymentNum=" + POut.PInt(cp.ClaimPaymentNum);
            DataTable table = General.GetTable(command);

            if (table.Rows.Count == 0)
            {
                return;
            }
            if (table.Rows[0][0].ToString() != "0" &&      //if claimpayment is already attached to a deposit
                PIn.PDouble(table.Rows[0][1].ToString()) != cp.CheckAmt)                 //and checkAmt changes
            {
                throw new ApplicationException(Lan.g("ClaimPayments", "Not allowed to change the amount on checks attached to deposits."));
            }
            command = "UPDATE claimpayment SET "
                      + "checkdate = " + POut.PDate(cp.CheckDate) + " "
                      + ",checkamt = '" + POut.PDouble(cp.CheckAmt) + "' "
                      + ",checknum = '" + POut.PString(cp.CheckNum) + "' "
                      + ",bankbranch = '" + POut.PString(cp.BankBranch) + "' "
                      + ",note = '" + POut.PString(cp.Note) + "' "
                      + ",ClinicNum = '" + POut.PInt(cp.ClinicNum) + "' "
                      + ",DepositNum = '" + POut.PInt(cp.DepositNum) + "' "
                      + ",CarrierName = '" + POut.PString(cp.CarrierName) + "' "
                      + "WHERE ClaimPaymentnum = '" + POut.PInt(cp.ClaimPaymentNum) + "'";
            //MessageBox.Show(string command);
            General.NonQ(command);
        }
示例#8
0
        ///<summary>Gets all ProcTPs for a given Patient ordered by ItemOrder.</summary>
        public static ProcTP[] Refresh(int patNum)
        {
            string command = "SELECT * FROM proctp "
                             + "WHERE PatNum=" + POut.PInt(patNum)
                             + " ORDER BY ItemOrder";
            DataTable table = General.GetTable(command);

            ProcTP[] List = new ProcTP[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                List[i]              = new ProcTP();
                List[i].ProcTPNum    = PIn.PInt(table.Rows[i][0].ToString());
                List[i].TreatPlanNum = PIn.PInt(table.Rows[i][1].ToString());
                List[i].PatNum       = PIn.PInt(table.Rows[i][2].ToString());
                List[i].ProcNumOrig  = PIn.PInt(table.Rows[i][3].ToString());
                List[i].ItemOrder    = PIn.PInt(table.Rows[i][4].ToString());
                List[i].Priority     = PIn.PInt(table.Rows[i][5].ToString());
                List[i].ToothNumTP   = PIn.PString(table.Rows[i][6].ToString());
                List[i].Surf         = PIn.PString(table.Rows[i][7].ToString());
                List[i].ADACode      = PIn.PString(table.Rows[i][8].ToString());
                List[i].Descript     = PIn.PString(table.Rows[i][9].ToString());
                List[i].FeeAmt       = PIn.PDouble(table.Rows[i][10].ToString());
                List[i].PriInsAmt    = PIn.PDouble(table.Rows[i][11].ToString());
                List[i].SecInsAmt    = PIn.PDouble(table.Rows[i][12].ToString());
                List[i].PatAmt       = PIn.PDouble(table.Rows[i][13].ToString());
            }
            return(List);
        }
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textChargeAmt.errorProvider1.GetError(textChargeAmt) != "" ||
         textDateStart.errorProvider1.GetError(textDateStart) != "" ||
         textDateStop.errorProvider1.GetError(textDateStop) != ""
         )
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (textDateStart.Text == "")
     {
         MsgBox.Show(this, "Start date cannot be left blank.");
         return;
     }
     if (PIn.PDate(textDateStart.Text) < DateTime.Today.AddMonths(-1))
     {
         MsgBox.Show(this, "Start date cannot be more than a month in the past.  But you can still enter previous charges manually in the account.");
         return;
     }
     RepeatCur.ADACode   = textADACode.Text;
     RepeatCur.ChargeAmt = PIn.PDouble(textChargeAmt.Text);
     RepeatCur.DateStart = PIn.PDate(textDateStart.Text);
     RepeatCur.DateStop  = PIn.PDate(textDateStop.Text);
     RepeatCur.Note      = textNote.Text;
     if (IsNew)
     {
         RepeatCharges.Insert(RepeatCur);
     }
     else
     {
         RepeatCharges.Update(RepeatCur);
     }
     DialogResult = DialogResult.OK;
 }
示例#10
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textAmount.errorProvider1.GetError(textAmount) != "" ||
         textDatePay.errorProvider1.GetError(textDatePay) != "" ||
         textProcDate.errorProvider1.GetError(textProcDate) != ""
         )
     {
         MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
         return;
     }
     if (textAmount.Text == "")
     {
         MessageBox.Show(Lan.g(this, "Please enter an amount."));
         return;
     }
     PaySplitCur.DatePay  = PIn.PDate(textDatePay.Text);         //gets overwritten anyway
     PaySplitCur.ProcDate = PIn.PDate(textProcDate.Text);
     PaySplitCur.SplitAmt = PIn.PDouble(textAmount.Text);
     if (listProvider.SelectedIndex != -1)
     {
         PaySplitCur.ProvNum = Providers.List[listProvider.SelectedIndex].ProvNum;
     }
     //if(!checkPatOtherFam.Checked){
     //This is still needed because it might be zero:
     //	PaySplitCur.PatNum=FamCur.List[listPatient.SelectedIndex].PatNum;
     //}
     //PayPlanNum already handled
     //PaySplitCur.InsertOrUpdate(IsNew);
     DialogResult = DialogResult.OK;
 }
示例#11
0
        ///<summary>This will eventually replace Misc.ClassesShared.ComputeBalance.  Returns true if a change was made.</summary>
        public static bool ComputeBalances(int patNum)
        {
            string command = "SELECT (SELECT EstBalance FROM patient WHERE PatNum=" + POut.PInt(patNum) + " GROUP BY PatNum) EstBalance, "
                             + "IFNULL((SELECT SUM(ProcFee) FROM procedurelog WHERE PatNum=" + POut.PInt(patNum) + " AND ProcStatus=2 GROUP BY PatNum),0)" //complete
                             + "+IFNULL((SELECT SUM(InsPayAmt) FROM claimproc WHERE PatNum=" + POut.PInt(patNum)
                             + " AND (Status=1 OR Status=4 OR Status=5) GROUP BY PatNum),0) "                                                              //received,supplemental,capclaim"
                             + "+IFNULL((SELECT SUM(AdjAmt) FROM adjustment WHERE PatNum=" + POut.PInt(patNum) + " GROUP BY PatNum),0) "
                             + "-IFNULL((SELECT SUM(SplitAmt) FROM paysplit WHERE PatNum=" + POut.PInt(patNum) + " GROUP BY PatNum),0) CalcBalance, "
                             + "IFNULL((SELECT SUM(InsPayEst) FROM claimproc WHERE PatNum=" + POut.PInt(patNum) + " GROUP BY PatNum),0) Estimate ";
            DataTable table   = General.GetTable(command);
            double    calcBal = PIn.PDouble(table.Rows[0]["CalcBalance"].ToString());

            if (!PrefB.GetBool("BalancesDontSubtractIns"))            //most common
            {
                calcBal -= PIn.PDouble(table.Rows[0]["Estimate"].ToString());
            }
            double estBal = PIn.PDouble(table.Rows[0]["EstBalance"].ToString());

            if (calcBal != estBal)
            {
                command = "UPDATE patient SET EstBalance='" + POut.PDouble(calcBal) + "' WHERE PatNum=" + POut.PInt(patNum);
                General.NonQ(command);
                return(true);
            }
            return(false);
        }
示例#12
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDate.errorProvider1.GetError(textDate) != "" ||
         textPrincipal.errorProvider1.GetError(textPrincipal) != "" ||
         textInterest.errorProvider1.GetError(textInterest) != ""
         )
     {
         MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
         return;
     }
     if (textPrincipal.Text == "")
     {
         textPrincipal.Text = "0";
     }
     if (textInterest.Text == "")
     {
         textInterest.Text = "0";
     }
     //todo: test dates?  The day of the month should be the same as all others
     PayPlanChargeCur.ChargeDate = PIn.PDate(textDate.Text);
     PayPlanChargeCur.Principal  = PIn.PDouble(textPrincipal.Text);
     PayPlanChargeCur.Interest   = PIn.PDouble(textInterest.Text);
     PayPlanChargeCur.Note       = textNote.Text;
     try{
         PayPlanCharges.InsertOrUpdate(PayPlanChargeCur, IsNew);
     }
     catch (ApplicationException ex) {          //even though it doesn't currently throw any exceptions
         MessageBox.Show(ex.Message);
         return;
     }
     DialogResult = DialogResult.OK;
 }
示例#13
0
        ///<summary>Does not alter any of the proc amounts except PaidHere and Remaining.</summary>
        private void ComputeProcTotals()
        {
            ProcPaidHere = 0;
            if (textAmount.errorProvider1.GetError(textAmount) == "")
            {
                ProcPaidHere = -PIn.PDouble(textAmount.Text);
            }
            if (ProcPaidHere == 0)
            {
                textProcPaidHere.Text = "";
            }
            else
            {
                textProcPaidHere.Text = ProcPaidHere.ToString("F");
            }
            //most of these are negative values, so add
            double remain =
                ProcFee
                + ProcInsPaid
                + ProcInsEst
                + ProcAdj
                + ProcPrevPaid
                + ProcPaidHere;

            labelProcRemain.Text = remain.ToString("c");
        }
示例#14
0
        ///<summary>Gets all PayPlanCharges for a guarantor or patient, ordered by date.</summary>
        public static PayPlanCharge[] Refresh(int patNum)
        {
            string command =
                "SELECT * FROM payplancharge "
                + "WHERE Guarantor='" + POut.PInt(patNum) + "' "
                + "OR PatNum='" + POut.PInt(patNum) + "' "
                + "ORDER BY ChargeDate";
            DataTable table = General.GetTable(command);

            PayPlanCharge[] List = new PayPlanCharge[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                List[i] = new PayPlanCharge();
                List[i].PayPlanChargeNum = PIn.PInt(table.Rows[i][0].ToString());
                List[i].PayPlanNum       = PIn.PInt(table.Rows[i][1].ToString());
                List[i].Guarantor        = PIn.PInt(table.Rows[i][2].ToString());
                List[i].PatNum           = PIn.PInt(table.Rows[i][3].ToString());
                List[i].ChargeDate       = PIn.PDate(table.Rows[i][4].ToString());
                List[i].Principal        = PIn.PDouble(table.Rows[i][5].ToString());
                List[i].Interest         = PIn.PDouble(table.Rows[i][6].ToString());
                List[i].Note             = PIn.PString(table.Rows[i][7].ToString());
                List[i].ProvNum          = PIn.PInt(table.Rows[i][8].ToString());
            }
            return(List);
        }
示例#15
0
        ///<summary>Gets a list of all RepeatCharges for a given patient.  Supply 0 to get a list for all patients.</summary>
        public static RepeatCharge[] Refresh(int patNum)
        {
            string command = "SELECT * FROM repeatcharge";

            if (patNum != 0)
            {
                command += " WHERE PatNum = " + POut.PInt(patNum);
            }
            command += " ORDER BY DateStart";
            DataTable table = General.GetTable(command);

            RepeatCharge[] List = new RepeatCharge[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                List[i] = new RepeatCharge();
                List[i].RepeatChargeNum = PIn.PInt(table.Rows[i][0].ToString());
                List[i].PatNum          = PIn.PInt(table.Rows[i][1].ToString());
                List[i].ProcCode        = PIn.PString(table.Rows[i][2].ToString());
                List[i].ChargeAmt       = PIn.PDouble(table.Rows[i][3].ToString());
                List[i].DateStart       = PIn.PDate(table.Rows[i][4].ToString());
                List[i].DateStop        = PIn.PDate(table.Rows[i][5].ToString());
                List[i].Note            = PIn.PString(table.Rows[i][6].ToString());
            }
            return(List);
        }
示例#16
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textFeeAmt.errorProvider1.GetError(textFeeAmt) != "" ||
         textPriInsAmt.errorProvider1.GetError(textPriInsAmt) != "" ||
         textSecInsAmt.errorProvider1.GetError(textSecInsAmt) != "" ||
         textDiscount.errorProvider1.GetError(textDiscount) != "" ||
         textPatAmt.errorProvider1.GetError(textPatAmt) != ""
         )
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (comboPriority.SelectedIndex == 0)
     {
         ProcCur.Priority = 0;
     }
     else
     {
         ProcCur.Priority = DefB.Short[(int)DefCat.TxPriorities][comboPriority.SelectedIndex - 1].DefNum;
     }
     ProcCur.ToothNumTP = textToothNumTP.Text;
     ProcCur.Surf       = textSurf.Text;
     ProcCur.ProcCode   = textCode.Text;
     ProcCur.Descript   = textDescript.Text;
     ProcCur.FeeAmt     = PIn.PDouble(textFeeAmt.Text);
     ProcCur.PriInsAmt  = PIn.PDouble(textPriInsAmt.Text);
     ProcCur.SecInsAmt  = PIn.PDouble(textSecInsAmt.Text);
     ProcCur.Discount   = PIn.PDouble(textDiscount.Text);
     ProcCur.PatAmt     = PIn.PDouble(textPatAmt.Text);
     ProcTPs.InsertOrUpdate(ProcCur, false);           //IsNew not applicable here
     DialogResult = DialogResult.OK;
 }
        private void butTransfer_Click(object sender, EventArgs e)
        {
            if (gridBal.GetSelectedIndex() == -1)
            {
                MsgBox.Show(this, "Please select a row from the Family Balances grid first.");
                return;
            }
            if (comboProv.SelectedIndex == -1)
            {
                MsgBox.Show(this, "Please select a provider first.");
                return;
            }
            double amt = PIn.PDouble(tableBalances.Rows[gridBal.GetSelectedIndex()]["StartBal"].ToString());
            //From-----------------------------------------------------------------------------------
            PaySplit split = new PaySplit();

            split.PatNum   = PatNum;
            split.PayNum   = PaymentCur.PayNum;
            split.ProcDate = PIn.PDate(textDate.Text);         //this may be updated upon closing
            split.DatePay  = PIn.PDate(textDate.Text);         //this may be updated upon closing
            split.ProvNum  = PIn.PInt(tableBalances.Rows[gridBal.GetSelectedIndex()]["ProvNum"].ToString());
            split.SplitAmt = amt;
            SplitList.Add(split);
            //To-----------------------------------------------------------------------------------
            split          = new PaySplit();
            split.PatNum   = PatNum;
            split.PayNum   = PaymentCur.PayNum;
            split.ProcDate = PIn.PDate(textDate.Text);
            split.DatePay  = PIn.PDate(textDate.Text);
            split.ProvNum  = Providers.List[comboProv.SelectedIndex].ProvNum;
            split.SplitAmt = -amt;
            SplitList.Add(split);
            FillMain();
        }
示例#18
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDate.errorProvider1.GetError(textDate) != "" ||
                textAPR.errorProvider1.GetError(textAPR) != "")
            {
                MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
                return;
            }

            if (PIn.PInt(textAPR.Text) < 2)
            {
                if (MessageBox.Show(Lan.g(this, "The APR is much lower than normal. Do you wish to proceed?"), "", MessageBoxButtons.OKCancel) != DialogResult.OK)
                {
                    return;
                }
            }
            //Patients.ResetAging();
            //Ledgers.UpdateFinanceCharges(PIn.PDate(textDate.Text));
            PatAging[] AgingList = Patients.GetAgingList();
            double     OverallBalance;

            for (int i = 0; i < AgingList.Length; i++)
            {
                OverallBalance = 0;              //this WILL NOT be the same as the patient's total balance
                if (radio30.Checked)
                {
                    OverallBalance = AgingList[i].Bal_31_60 + AgingList[i].Bal_61_90 + AgingList[i].BalOver90;
                }
                if (radio60.Checked)
                {
                    OverallBalance = AgingList[i].Bal_61_90 + AgingList[i].BalOver90;
                }
                if (radio90.Checked)
                {
                    OverallBalance = AgingList[i].BalOver90;
                }
                if (OverallBalance > 0)
                {
                    Adjustment AdjustmentCur = new Adjustment();
                    AdjustmentCur.PatNum = AgingList[i].PatNum;
                    //AdjustmentCur.DateEntry=PIn.PDate(textDate.Text);//automatically handled
                    AdjustmentCur.AdjDate  = PIn.PDate(textDate.Text);
                    AdjustmentCur.ProcDate = PIn.PDate(textDate.Text);
                    AdjustmentCur.AdjType  = DefB.Short[(int)DefCat.AdjTypes]
                                             [(int)ALPosIndices[listAdjType.SelectedIndex]].DefNum;
                    AdjustmentCur.AdjNote = "Finance Charge";
                    AdjustmentCur.AdjAmt  = Math.Round(((PIn.PDouble(textAPR.Text) * .01 / 12) * OverallBalance), 2);
                    AdjustmentCur.ProvNum = AgingList[i].PriProv;
                    Adjustments.InsertOrUpdate(AdjustmentCur, true);
                }
            }
            Prefs.UpdateString("FinanceChargeAPR", textAPR.Text);
            Prefs.UpdateInt("FinanceChargeAdjustmentType",
                            DefB.Short[(int)DefCat.AdjTypes][(int)ALPosIndices[listAdjType.SelectedIndex]].DefNum);
            Prefs.UpdateString("FinanceChargeLastRun", POut.PDate(DateTime.Today, false));
            DataValid.SetInvalid(InvalidTypes.Prefs);
            MessageBox.Show(Lan.g(this, "Finance Charges Added."));
            DialogResult = DialogResult.OK;
        }
示例#19
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDate.errorProvider1.GetError(textDate) != ""
                )
            {
                MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
                return;
            }
            if (tb2.SelectedIndices.Length == 0)
            {
                MessageBox.Show(Lan.g(this, "At least one item must be selected, or use the delete button."));
                return;
            }
            if (comboClinic.SelectedIndex == 0)
            {
                ClaimPaymentCur.ClinicNum = 0;
            }
            else
            {
                ClaimPaymentCur.ClinicNum = Clinics.List[comboClinic.SelectedIndex - 1].ClinicNum;
            }
            ClaimPaymentCur.CheckAmt    = PIn.PDouble(textAmount.Text);
            ClaimPaymentCur.CheckDate   = PIn.PDate(textDate.Text);
            ClaimPaymentCur.CheckNum    = textCheckNum.Text;
            ClaimPaymentCur.BankBranch  = textBankBranch.Text;
            ClaimPaymentCur.CarrierName = textCarrierName.Text;
            ClaimPaymentCur.Note        = textNote.Text;
            try{
                ClaimPayments.Update(ClaimPaymentCur);                //error thrown if trying to change amount and already attached to a deposit.
            }
            catch (ApplicationException ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            //this could be optimized to only save changes.
            //Would require a starting AL to compare to.
            //But this isn't bad, since changes all saved at the very end
            ArrayList ALselected = new ArrayList();

            for (int i = 0; i < tb2.SelectedIndices.Length; i++)
            {
                ALselected.Add(tb2.SelectedIndices[i]);
            }
            for (int i = 0; i < splits.Length; i++)
            {
                if (ALselected.Contains(i))                //row is selected
                {
                    ClaimProcs.SetForClaim(splits[i].ClaimNum, ClaimPaymentCur.ClaimPaymentNum,
                                           ClaimPaymentCur.CheckDate, true);
                }
                else                 //row not selected
                {
                    ClaimProcs.SetForClaim(splits[i].ClaimNum, ClaimPaymentCur.ClaimPaymentNum,
                                           ClaimPaymentCur.CheckDate, false);
                }
            }
            DialogResult = DialogResult.OK;
        }
 private void textEnd_TextChanged(object sender, EventArgs e)
 {
     if (textStart.errorProvider1.GetError(textStart) != "" ||
         textEnd.errorProvider1.GetError(textEnd) != ""
         )
     {
         return;
     }
     textTarget.Text = (PIn.PDouble(textEnd.Text) - PIn.PDouble(textStart.Text)).ToString("n");
 }
示例#21
0
        ///<summary>Called just before Allocate in FormPayment.butOK click.  If true, then it will prompt the user before allocating.</summary>
        public static bool AllocationRequired(double payAmt, int patNum)
        {
            string command = "SELECT EstBalance FROM patient "
                             + "WHERE PatNum = " + POut.PInt(patNum);
            double estBal = PIn.PDouble(General.GetCount(command));

            if (payAmt > estBal)
            {
                return(true);
            }
            return(false);
        }
示例#22
0
        public static double GetValAmountTotal(Claim Cur, string Code)
        {
            double    total   = 0;
            string    command = "SELECT * FROM claimvalcodelog WHERE ClaimNum='" + POut.PInt(Cur.ClaimNum) + "' AND ValCode='" + POut.PString(Code) + "'";
            DataTable table   = General.GetTable(command);

            for (int i = 0; i < table.Rows.Count; i++)
            {
                total += PIn.PDouble(table.Rows[i][4].ToString());
            }
            return(total);
        }
示例#23
0
        /// <summary>Gets info directly from database. Used from PayPlan and Account windows to get the amount paid so far on one payment plan.</summary>
        public static double GetAmtPaid(int payPlanNum)
        {
            string command = "SELECT SUM(paysplit.SplitAmt) FROM paysplit "
                             + "WHERE paysplit.PayPlanNum = '" + payPlanNum.ToString() + "' "
                             + "GROUP BY paysplit.PayPlanNum";
            DataTable table = General.GetTable(command);

            if (table.Rows.Count == 0)
            {
                return(0);
            }
            return(PIn.PDouble(table.Rows[0][0].ToString()));
        }
示例#24
0
        private void butImport_Click(object sender, EventArgs e)
        {
            if (!MsgBox.Show(this, true, "If you want a clean slate, the current fee schedule should be cleared first.  When imported, any fees that are found in the text file will overwrite values of the current fee schedule showing in the main window.  Are you sure you want to continue?"))
            {
                return;
            }
            Cursor = Cursors.WaitCursor;
            OpenFileDialog Dlg = new OpenFileDialog();

            if (Directory.Exists(PrefB.GetString("ExportPath")))
            {
                Dlg.InitialDirectory = PrefB.GetString("ExportPath");
            }
            else if (Directory.Exists("C:\\"))
            {
                Dlg.InitialDirectory = "C:\\";
            }
            if (Dlg.ShowDialog() != DialogResult.OK)
            {
                Cursor = Cursors.Default;
                return;
            }
            if (!File.Exists(Dlg.FileName))
            {
                Cursor = Cursors.Default;
                MsgBox.Show(this, "File not found");
                return;
            }
            string[] fields;
            double   fee;
            int      schedI = DefB.GetOrder(DefCat.FeeSchedNames, SchedNum);

            using (StreamReader sr = new StreamReader(Dlg.FileName)){
                string line = sr.ReadLine();
                while (line != null)
                {
                    fields = line.Split(new string[1] {
                        "\t"
                    }, StringSplitOptions.None);
                    if (fields.Length > 1 && fields[1] != "")                //skips blank fees
                    {
                        fee = PIn.PDouble(fields[1]);
                        Fees.Import(fields[0], fee, schedI);
                    }
                    line = sr.ReadLine();
                }
            }
            Cursor       = Cursors.Default;
            DialogResult = DialogResult.OK;
        }
示例#25
0
        private static Deposit[] RefreshAndFill(string command)
        {
            DataTable table = General.GetTable(command);

            Deposit[] List = new Deposit[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                List[i]                 = new Deposit();
                List[i].DepositNum      = PIn.PInt(table.Rows[i][0].ToString());
                List[i].DateDeposit     = PIn.PDate(table.Rows[i][1].ToString());
                List[i].BankAccountInfo = PIn.PString(table.Rows[i][2].ToString());
                List[i].Amount          = PIn.PDouble(table.Rows[i][3].ToString());
            }
            return(List);
        }
示例#26
0
        private static Reconcile[] RefreshAndFill(string command)
        {
            DataTable table = General.GetTable(command);

            Reconcile[] List = new Reconcile[table.Rows.Count];
            for (int i = 0; i < List.Length; i++)
            {
                List[i] = new Reconcile();
                List[i].ReconcileNum  = PIn.PInt(table.Rows[i][0].ToString());
                List[i].AccountNum    = PIn.PInt(table.Rows[i][1].ToString());
                List[i].StartingBal   = PIn.PDouble(table.Rows[i][2].ToString());
                List[i].EndingBal     = PIn.PDouble(table.Rows[i][3].ToString());
                List[i].DateReconcile = PIn.PDate(table.Rows[i][4].ToString());
                List[i].IsLocked      = PIn.PBool(table.Rows[i][5].ToString());
            }
            return(List);
        }
示例#27
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textRight.errorProvider1.GetError(textRight) != "" ||
                textDown.errorProvider1.GetError(textDown) != "" ||
                textDaysPast.errorProvider1.GetError(textDaysPast) != "" ||
                textDaysFuture.errorProvider1.GetError(textDaysFuture) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            if (textPostcardsPerSheet.Text != "1" &&
                textPostcardsPerSheet.Text != "3" &&
                textPostcardsPerSheet.Text != "4")
            {
                MsgBox.Show(this, "The value in postcards per sheet must be 1, 3, or 4");
                return;
            }

            Prefs.UpdateString("RecallPattern", textPattern.Text);

            Prefs.UpdateString("RecallProcedures", textProcs.Text);

            Prefs.UpdateString("RecallBW", textBW.Text);

            Prefs.UpdateString("RecallPostcardMessage", textPostcardMessage.Text);

            Prefs.UpdateString("RecallPostcardFamMsg", textPostcardFamMsg.Text);

            Prefs.UpdateString("ConfirmPostcardMessage", textConfirmPostcardMessage.Text);

            Prefs.UpdateString("RecallPostcardsPerSheet", textPostcardsPerSheet.Text);

            Prefs.UpdateBool("RecallCardsShowReturnAdd", checkReturnAdd.Checked);

            Prefs.UpdateBool("RecallGroupByFamily", checkGroupFamilies.Checked);

            Prefs.UpdateInt("RecallDaysPast", PIn.PInt(textDaysPast.Text));
            Prefs.UpdateInt("RecallDaysFuture", PIn.PInt(textDaysFuture.Text));

            Prefs.UpdateDouble("RecallAdjustRight", PIn.PDouble(textRight.Text));
            Prefs.UpdateDouble("RecallAdjustDown", PIn.PDouble(textDown.Text));

            DataValid.SetInvalid(InvalidTypes.Prefs);
            DialogResult = DialogResult.OK;
        }
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDate.errorProvider1.GetError(textDate) != "" ||
         textStart.errorProvider1.GetError(textStart) != "" ||
         textEnd.errorProvider1.GetError(textEnd) != ""
         )
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     ReconcileCur.DateReconcile = PIn.PDate(textDate.Text);
     ReconcileCur.StartingBal   = PIn.PDouble(textStart.Text);
     ReconcileCur.EndingBal     = PIn.PDouble(textEnd.Text);
     ReconcileCur.IsLocked      = checkLocked.Checked;
     Reconciles.Update(ReconcileCur);
     SaveList();
     DialogResult = DialogResult.OK;
 }
示例#29
0
        ///<summary>Gets a list of all benefits for a given list of patplans for one patient.</summary>
        public static Benefit[] Refresh(PatPlan[] listForPat)
        {
            if (listForPat.Length == 0)
            {
                return(new Benefit[0]);
            }
            string s = "";

            for (int i = 0; i < listForPat.Length; i++)
            {
                if (i > 0)
                {
                    s += " OR";
                }
                s += " PlanNum=" + POut.PInt(listForPat[i].PlanNum);
                s += " OR";
                s += " PatPlanNum=" + POut.PInt(listForPat[i].PatPlanNum);
            }
            string command = "SELECT * FROM benefit"
                             + " WHERE" + s;
            //Debug.WriteLine(command);
            DataTable table = General.GetTable(command);

            Benefit[] List = new Benefit[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                List[i]                   = new Benefit();
                List[i].BenefitNum        = PIn.PInt(table.Rows[i][0].ToString());
                List[i].PlanNum           = PIn.PInt(table.Rows[i][1].ToString());
                List[i].PatPlanNum        = PIn.PInt(table.Rows[i][2].ToString());
                List[i].CovCatNum         = PIn.PInt(table.Rows[i][3].ToString());
                List[i].OldCode           = PIn.PString(table.Rows[i][4].ToString());
                List[i].BenefitType       = (InsBenefitType)PIn.PInt(table.Rows[i][5].ToString());
                List[i].Percent           = PIn.PInt(table.Rows[i][6].ToString());
                List[i].MonetaryAmt       = PIn.PDouble(table.Rows[i][7].ToString());
                List[i].TimePeriod        = (BenefitTimePeriod)PIn.PInt(table.Rows[i][8].ToString());
                List[i].QuantityQualifier = (BenefitQuantity)PIn.PInt(table.Rows[i][9].ToString());
                List[i].Quantity          = PIn.PInt(table.Rows[i][10].ToString());
                List[i].CodeNum           = PIn.PInt(table.Rows[i][11].ToString());
                List[i].CoverageLevel     = (BenefitCoverageLevel)PIn.PInt(table.Rows[i][12].ToString());
            }
            Array.Sort(List);
            return(List);
        }
示例#30
0
        ///<summary></summary>
        public static ClaimProc[] Refresh(int patNum)
        {
            string command =
                "SELECT * from claimproc "
                + "WHERE PatNum = '" + patNum.ToString() + "' ORDER BY LineNumber";
            DataTable table = General.GetTable(command);

            ClaimProc[] List = new ClaimProc[table.Rows.Count];
            for (int i = 0; i < List.Length; i++)
            {
                List[i] = new ClaimProc();
                List[i].ClaimProcNum    = PIn.PInt(table.Rows[i][0].ToString());
                List[i].ProcNum         = PIn.PInt(table.Rows[i][1].ToString());
                List[i].ClaimNum        = PIn.PInt(table.Rows[i][2].ToString());
                List[i].PatNum          = PIn.PInt(table.Rows[i][3].ToString());
                List[i].ProvNum         = PIn.PInt(table.Rows[i][4].ToString());
                List[i].FeeBilled       = PIn.PDouble(table.Rows[i][5].ToString());
                List[i].InsPayEst       = PIn.PDouble(table.Rows[i][6].ToString());
                List[i].DedApplied      = PIn.PDouble(table.Rows[i][7].ToString());
                List[i].Status          = (ClaimProcStatus)PIn.PInt(table.Rows[i][8].ToString());
                List[i].InsPayAmt       = PIn.PDouble(table.Rows[i][9].ToString());
                List[i].Remarks         = PIn.PString(table.Rows[i][10].ToString());
                List[i].ClaimPaymentNum = PIn.PInt(table.Rows[i][11].ToString());
                List[i].PlanNum         = PIn.PInt(table.Rows[i][12].ToString());
                List[i].DateCP          = PIn.PDate(table.Rows[i][13].ToString());
                List[i].WriteOff        = PIn.PDouble(table.Rows[i][14].ToString());
                List[i].CodeSent        = PIn.PString(table.Rows[i][15].ToString());
                List[i].AllowedAmt      = PIn.PDouble(table.Rows[i][16].ToString());
                List[i].Percentage      = PIn.PInt(table.Rows[i][17].ToString());
                List[i].PercentOverride = PIn.PInt(table.Rows[i][18].ToString());
                List[i].CopayAmt        = PIn.PDouble(table.Rows[i][19].ToString());
                List[i].OverrideInsEst  = PIn.PDouble(table.Rows[i][20].ToString());
                List[i].NoBillIns       = PIn.PBool(table.Rows[i][21].ToString());
                List[i].DedBeforePerc   = PIn.PBool(table.Rows[i][22].ToString());
                List[i].OverAnnualMax   = PIn.PDouble(table.Rows[i][23].ToString());
                List[i].PaidOtherIns    = PIn.PDouble(table.Rows[i][24].ToString());
                List[i].BaseEst         = PIn.PDouble(table.Rows[i][25].ToString());
                List[i].CopayOverride   = PIn.PDouble(table.Rows[i][26].ToString());
                List[i].ProcDate        = PIn.PDate(table.Rows[i][27].ToString());
                List[i].DateEntry       = PIn.PDate(table.Rows[i][28].ToString());
                List[i].LineNumber      = PIn.PInt(table.Rows[i][29].ToString());
            }
            return(List);
        }