Exemple #1
0
        private void FillProcedure()
        {
            if (_adjustmentCur.ProcNum == 0)
            {
                textProcDate2.Text       = "";
                textProcProv.Text        = "";
                textProcTooth.Text       = "";
                textProcDescription.Text = "";
                textProcFee.Text         = "";
                textProcWriteoff.Text    = "";
                textProcInsPaid.Text     = "";
                textProcInsEst.Text      = "";
                textProcAdj.Text         = "";
                textProcPatPaid.Text     = "";
                textProcAdjCur.Text      = "";
                labelProcRemain.Text     = "";
                _adjRemAmt = 0;
                return;
            }
            Procedure         procCur         = Procedures.GetOneProc(_adjustmentCur.ProcNum, false);
            List <ClaimProc>  listClaimProcs  = ClaimProcs.Refresh(procCur.PatNum);
            List <Adjustment> listAdjustments = Adjustments.Refresh(procCur.PatNum)
                                                .Where(x => x.ProcNum == procCur.ProcNum && x.AdjNum != _adjustmentCur.AdjNum).ToList();

            textProcDate.Text        = procCur.ProcDate.ToShortDateString();
            textProcDate2.Text       = procCur.ProcDate.ToShortDateString();
            textProcProv.Text        = Providers.GetAbbr(procCur.ProvNum);
            textProcTooth.Text       = Tooth.ToInternat(procCur.ToothNum);
            textProcDescription.Text = ProcedureCodes.GetProcCode(procCur.CodeNum).Descript;
            double procWO      = -ClaimProcs.ProcWriteoff(listClaimProcs, procCur.ProcNum);
            double procInsPaid = -ClaimProcs.ProcInsPay(listClaimProcs, procCur.ProcNum);
            double procInsEst  = -ClaimProcs.ProcEstNotReceived(listClaimProcs, procCur.ProcNum);
            double procAdj     = listAdjustments.Sum(x => x.AdjAmt);
            double procPatPaid = -PaySplits.GetTotForProc(procCur);

            textProcFee.Text      = procCur.ProcFeeTotal.ToString("F");
            textProcWriteoff.Text = procWO == 0?"":procWO.ToString("F");
            textProcInsPaid.Text  = procInsPaid == 0?"":procInsPaid.ToString("F");
            textProcInsEst.Text   = procInsEst == 0?"":procInsEst.ToString("F");
            textProcAdj.Text      = procAdj == 0?"":procAdj.ToString("F");
            textProcPatPaid.Text  = procPatPaid == 0?"":procPatPaid.ToString("F");
            //Intelligently sum the values above based on statuses instead of blindly adding all of the values together.
            //The remaining amount is typically called the "patient portion" so utilze the centralized method that gets the patient portion.
            decimal patPort    = ClaimProcs.GetPatPortion(procCur, listClaimProcs, listAdjustments);
            double  procAdjCur = 0;

            if (textAmount.errorProvider1.GetError(textAmount) == "")
            {
                if (listTypePos.SelectedIndex > -1)              //pos
                {
                    procAdjCur = PIn.Double(textAmount.Text);
                }
                else if (listTypeNeg.SelectedIndex > -1 || Defs.GetValue(DefCat.AdjTypes, _adjustmentCur.AdjType) == "dp")           //neg or discount plan
                {
                    procAdjCur = -PIn.Double(textAmount.Text);
                }
            }
            textProcAdjCur.Text = procAdjCur == 0?"":procAdjCur.ToString("F");
            //Add the current adjustment amount to the patient portion which will give the newly calculated remaining amount.
            _adjRemAmt           = (decimal)procAdjCur + (decimal)procPatPaid + patPort;
            labelProcRemain.Text = _adjRemAmt.ToString("c");
        }