Exemple #1
0
		private void FillGrid() {
			long course=(comboCourse.SelectedIndex==0) ? 0:_listSchoolCourses[comboCourse.SelectedIndex-1].SchoolCourseNum;
			long instructor=(comboInstructor.SelectedIndex==0) ? 0:_listInstructor[comboInstructor.SelectedIndex-1].ProvNum;
			DataTable table=Evaluations.GetFilteredList(DateTime.Parse(textDateStart.Text),DateTime.Parse(textDateEnd.Text),textLastName.Text,textFirstName.Text,PIn.Long(textProvNum.Text),course,instructor);
			gridMain.BeginUpdate();
			gridMain.ListGridColumns.Clear();
			GridColumn col=new GridColumn(Lan.g("TableEvaluations","Date"),70,HorizontalAlignment.Center);
			gridMain.ListGridColumns.Add(col);
			col=new GridColumn(Lan.g("TableEvaluations","Title"),90);
			gridMain.ListGridColumns.Add(col);
			col=new GridColumn(Lan.g("TableEvaluations","Instructor"),90);
			gridMain.ListGridColumns.Add(col);
			col=new GridColumn(Lan.g("TableEvaluations","ProvNum"),60);
			gridMain.ListGridColumns.Add(col);
			col=new GridColumn(Lan.g("TableEvaluations","Last Name"),90);
			gridMain.ListGridColumns.Add(col);
			col=new GridColumn(Lan.g("TableEvaluations","First Name"),80);
			gridMain.ListGridColumns.Add(col);
			col=new GridColumn(Lan.g("TableEvaluations","Course"),90);
			gridMain.ListGridColumns.Add(col);
			col=new GridColumn(Lan.g("TableEvaluations","Grade"),60);
			gridMain.ListGridColumns.Add(col);
			col=new GridColumn(Lan.g("TableEvaluations","Grading Scale"),90);
			gridMain.ListGridColumns.Add(col);
			gridMain.ListGridRows.Clear();
			GridRow row;
			for(int i=0;i<table.Rows.Count;i++) {
				row=new GridRow();
				row.Cells.Add(DateTime.Parse(table.Rows[i]["DateEval"].ToString()).ToShortDateString());
				row.Cells.Add(table.Rows[i]["EvalTitle"].ToString());
				row.Cells.Add(table.Rows[i]["InstructNum"].ToString());
				row.Cells.Add(table.Rows[i]["StudentNum"].ToString());
				row.Cells.Add(table.Rows[i]["LName"].ToString());
				row.Cells.Add(table.Rows[i]["FName"].ToString());
				row.Cells.Add(table.Rows[i]["CourseID"].ToString());
				row.Cells.Add(table.Rows[i]["OverallgradeShowing"].ToString());
				row.Cells.Add(table.Rows[i]["Description"].ToString());
				row.Tag=table.Rows[i]["EvaluationNum"].ToString();//To keep the correct reference to the Evaluation even when filtering the list.
				gridMain.ListGridRows.Add(row);
			}
			gridMain.EndUpdate();
		}
Exemple #2
0
        private void SetTextBoxes()
        {
            List <PayPlanEntry> listSelectedEntries = new List <PayPlanEntry>();

            for (int i = 0; i < gridMain.SelectedIndices.Count(); i++)          //fill the list with all the selected items in the grid.
            {
                listSelectedEntries.Add((PayPlanEntry)(gridMain.Rows[gridMain.SelectedIndices[i]].Tag));
            }
            bool isUpdateButton = false;          //keep track of the state of the button, if it is add or update.

            if (listSelectedEntries.Count == 0)   //if there are no entries selected
            //button should say Add, textboxes should be editable. No attached procedure.
            {
                butAddOrUpdate.Text = Lan.g(this, "Add");
                textAmt.Text        = "";
                textDate.Text       = "";
                textCode.Text       = Lan.g(this, "None");
                textNote.Text       = "";
                textAmt.ReadOnly    = false;
                textDate.ReadOnly   = false;
                textNote.ReadOnly   = false;
            }
            else if (listSelectedEntries.Count == 1)                 //if there is one entry selected
            {
                PayPlanEntry selectedEntry = listSelectedEntries[0]; //all textboxes should be editable
                textAmt.ReadOnly  = false;
                textDate.ReadOnly = false;
                textNote.ReadOnly = false;
                if (selectedEntry.IsChargeOrd)                  //if it's a PayPlanCharge
                //button should say Update, text boxes should fill with info from that charge.
                {
                    butAddOrUpdate.Text = Lan.g(this, "Update");
                    isUpdateButton      = true;
                    textAmt.Text        = selectedEntry.AmtStr;
                    textNote.Text       = selectedEntry.NoteStr;
                    if (selectedEntry.ProcStatOrd == ProcStat.TP && selectedEntry.ProcNumOrd != 0)                 //if tp, grey out the date textbox. it should always be maxvalue.
                    //tp and procnum==0 means that it's the unattached row, in which case we don't want to make the text boxes ready-only.
                    {
                        textDate.ReadOnly = true;
                        textDate.Text     = "";
                    }
                    else
                    {
                        textDate.Text = selectedEntry.CredDateStr;
                    }
                    if (selectedEntry.Proc == null)                    //selected charge could be unattached.
                    {
                        textCode.Text = Lan.g(this, "Unattached");
                    }
                    else
                    {
                        textCode.Text = ProcedureCodes.GetStringProcCode(selectedEntry.Proc.CodeNum);
                    }
                }
                else                  // selected line item is a procedure (or the "Unattached" entry)
                                      //button should say "Add", text boxes should fill with info from that procedure (or "unattached").
                {
                    butAddOrUpdate.Text = Lan.g(this, "Add");
                    if (selectedEntry.Proc == null)
                    {
                        textCode.Text = Lan.g(this, "Unattached");
                        textAmt.Text  = "0.00";
                        textNote.Text = "";
                        textDate.Text = DateTimeOD.Today.ToShortDateString();
                    }
                    else                       //if it is a procedure (and not the "unattached" row)
                    {
                        List <PayPlanEntry> listEntriesForProc = _listPayPlanEntries
                                                                 .Where(x => x.ProcNumOrd == selectedEntry.ProcNumOrd)
                                                                 .Where(x => x.IsChargeOrd == true).ToList();
                        if (listEntriesForProc.Count == 0)          //if there are no other charges attached to the procedure
                        {
                            textAmt.Text = selectedEntry.RemBefStr; //set textAmt to the value in RemBefore
                        }
                        else                                        //if there are other charges attached, fill the amount textbox with the minimum value in the RemAftr column.
                        {
                            textAmt.Text = listEntriesForProc.Min(x => PIn.Double(x.RemAftStr)).ToString("f");
                        }
                        textDate.Text = DateTimeOD.Today.ToShortDateString();
                        textNote.Text = ProcedureCodes.GetStringProcCode(selectedEntry.Proc.CodeNum) + ": " + Procedures.GetDescription(selectedEntry.Proc);
                        textCode.Text = ProcedureCodes.GetStringProcCode(selectedEntry.Proc.CodeNum);
                    }
                }
            }
            else if (listSelectedEntries.Count > 1)            //if they selected multiple line items
            //change the button to say "add"
            //blank out and make read-only all text boxes.
            {
                butAddOrUpdate.Text = Lan.g(this, "Add");
                textAmt.Text        = "";
                textDate.Text       = "";
                textNote.Text       = "";
                textCode.Text       = Lan.g(this, "Multiple");
                textAmt.ReadOnly    = true;
                textDate.ReadOnly   = true;
                textNote.ReadOnly   = true;
            }
            if (listSelectedEntries.Any(x => Security.IsGlobalDateLock(Permissions.PayPlanEdit, x.DateOrd, true)))
            {
                if (isUpdateButton)
                {
                    butAddOrUpdate.Enabled = false;                  //only disallow them from updating a tx credit, adding a new one is okay.
                }
                else
                {
                    butAddOrUpdate.Enabled = true;
                }
                butDelete.Enabled = false;
            }
            else
            {
                butAddOrUpdate.Enabled = true;
                butDelete.Enabled      = true;
            }
        }
		private void butOK_Click(object sender,System.EventArgs e) {
			int payPlanVersion = PrefC.GetInt(PrefName.PayPlansVersion);
			string bDate;
			string eDate;
			decimal rcvStart = 0;
			decimal rcvProd = 0;
			decimal rcvPayPlanCharges = 0;
			decimal rcvAdj = 0;
			decimal rcvWriteoff = 0;
			decimal rcvPayment = 0;
			decimal rcvInsPayment = 0;
			decimal runningRcv = 0;
			decimal rcvDaily = 0;
			decimal[] colTotals = new decimal[9];
			string wMonth;
			string wYear;
			string wDay = "01";
			string wDate;
			// Get the year / month and instert the 1st of the month for stop point for calculated running balance
			wYear = date1.SelectionStart.Year.ToString();
			wMonth = date1.SelectionStart.Month.ToString();
			if(wMonth.Length<2) {
				wMonth = "0" + wMonth;
			}
			wDate = wYear +"-"+ wMonth +"-"+ wDay;
			List<long> listProvNums = new List<long>();
			bool hasAllProvs = (listProv.SelectedIndices[0]==0);
			if(!hasAllProvs) {
				for(int i = 0;i<listProv.SelectedIndices.Count;i++) {
					//Minus 1 due to the 'Practice' option.
					listProvNums.Add(_listProvs[listProv.SelectedIndices[i]-1].ProvNum);
				}
			}
			bool isPayPlan2;
			if(payPlanVersion==2) {
				isPayPlan2=true;
			}
			else {
				isPayPlan2=false;
			}
			ReportComplex report = new ReportComplex(true,false);
			DataTable TableCharge = new DataTable();  //charges
			DataTable TablePayPlanCharge = new DataTable();  //PayPlanCharges
			DataTable TableCapWriteoff = new DataTable();  //capComplete writeoffs
			DataTable TableInsWriteoff = new DataTable();  //ins writeoffs
			DataTable TablePay = new DataTable();  //payments - Patient
			DataTable TableIns = new DataTable();  //payments - Ins, added SPK 
			DataTable TableAdj = new DataTable();  //adjustments
			
			//
			// Main Loop:  This will loop twice 1st loop gets running balance to start of month selected
			//             2nd will break the numbers down by day and calculate the running balances
			//
			for(int j = 0;j <= 1;j++) {
				if(j == 0) {
					bDate = "0001-01-01";
					eDate = wDate;
				}
				else {
					bDate = wDate;
					eDate = POut.Date(date1.SelectionStart.AddDays(1)).Substring(1,10);// Needed because all Queries are < end date to get correct Starting AR
				}
				TableCharge=RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart,listProvNums,radioWriteoffPay.Checked,isPayPlan2,wDate,eDate,bDate,"TableCharge");
				if(isPayPlan2) {
					TablePayPlanCharge=RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart,listProvNums,radioWriteoffPay.Checked,isPayPlan2,wDate,eDate,bDate,"TablePayPlanCharge");
				}
				TableCapWriteoff=RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart,listProvNums,radioWriteoffPay.Checked,isPayPlan2,wDate,eDate,bDate,"TableCapWriteoff");
				TableInsWriteoff=RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart,listProvNums,radioWriteoffPay.Checked,isPayPlan2,wDate,eDate,bDate,"TableInsWriteoff");
				TablePay=RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart,listProvNums,radioWriteoffPay.Checked,isPayPlan2,wDate,eDate,bDate,"TablePay");
				TableIns=RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart,listProvNums,radioWriteoffPay.Checked,isPayPlan2,wDate,eDate,bDate,"TableIns");
				TableAdj=RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart,listProvNums,radioWriteoffPay.Checked,isPayPlan2,wDate,eDate,bDate,"TableAdj");
				//Sum up all the transactions grouped by date.
				Dictionary<DateTime,decimal> dictPayPlanCharges = TablePayPlanCharge.Select().GroupBy(x => PIn.Date(x["ChargeDate"].ToString()))
					.ToDictionary(y => y.Key,y => y.ToList().Sum(z => PIn.Decimal(z["Amt"].ToString())));
				//1st Loop Calculate running Accounts Receivable upto the 1st of the Month Selected
				//2nd Loop Calculate the Daily Accounts Receivable upto the Date Selected
				//Finaly Generate Report showing the breakdown upto the date specified with totals for what is on the report
				if(j == 0) {
					for(int k = 0;k < TableCharge.Rows.Count;k++) {
						rcvProd += PIn.Decimal(TableCharge.Rows[k][1].ToString());
					}
					rcvPayPlanCharges+=dictPayPlanCharges.Sum(x => x.Value);
					for(int k = 0;k < TableCapWriteoff.Rows.Count;k++) {
						rcvWriteoff += PIn.Decimal(TableCapWriteoff.Rows[k][1].ToString());
					}
					for(int k = 0;k < TableInsWriteoff.Rows.Count;k++) {
						rcvWriteoff += PIn.Decimal(TableInsWriteoff.Rows[k][1].ToString());
					}
					for(int k = 0;k < TablePay.Rows.Count;k++) {
						rcvPayment += PIn.Decimal(TablePay.Rows[k][1].ToString());
					}
					for(int k = 0;k < TableIns.Rows.Count;k++) {
						rcvInsPayment += PIn.Decimal(TableIns.Rows[k][1].ToString());
					}
					for(int k = 0;k < TableAdj.Rows.Count;k++) {
						rcvAdj += PIn.Decimal(TableAdj.Rows[k][1].ToString());
					}
					TableCharge.Clear();
					TablePayPlanCharge.Clear();
					TableCapWriteoff.Clear();
					TableInsWriteoff.Clear();
					TablePay.Clear();
					TableIns.Clear();
					TableAdj.Clear();
					rcvStart = (rcvProd + rcvPayPlanCharges + rcvAdj - rcvWriteoff) - (rcvPayment + rcvInsPayment);
				}
				else {
					rcvAdj = 0;
					rcvInsPayment = 0;
					rcvPayment = 0;
					rcvProd = 0;
					rcvPayPlanCharges = 0;
					rcvWriteoff = 0;
					rcvDaily = 0;
					runningRcv = rcvStart;
					DataTable TableQ = new DataTable();
					TableQ.Columns.Add("Date");
					TableQ.Columns.Add("Charges");
					TableQ.Columns.Add("PayPlanCharges");
					TableQ.Columns.Add("Adjustments");
					TableQ.Columns.Add("Writeoffs");
					TableQ.Columns.Add("Payment");
					TableQ.Columns.Add("InsPayment");
					TableQ.Columns.Add("Daily");
					TableQ.Columns.Add("Running");
					eDate = POut.Date(date1.SelectionStart).Substring(1,10);// Reset EndDate to Selected Date
					DateTime[] dates = new DateTime[(PIn.Date(eDate) - PIn.Date(bDate)).Days + 1];
					for(int i = 0;i < dates.Length;i++) {//usually 31 days in loop
						dates[i] = PIn.Date(bDate).AddDays(i);
						//create new row called 'row' based on structure of TableQ
						DataRow row = TableQ.NewRow();
						row[0] = dates[i].ToShortDateString();
						for(int k = 0;k < TableCharge.Rows.Count;k++) {
							if(dates[i] == (PIn.Date(TableCharge.Rows[k][0].ToString()))) {
								rcvProd += PIn.Decimal(TableCharge.Rows[k][1].ToString());
							}
						}
						decimal rcvPayPlanChargesForDay = 0;
						if(dictPayPlanCharges.TryGetValue(dates[i],out rcvPayPlanChargesForDay)) {
							rcvPayPlanCharges += rcvPayPlanChargesForDay;
						}
						for(int k = 0;k < TableCapWriteoff.Rows.Count;k++) {
							if(dates[i] == (PIn.Date(TableCapWriteoff.Rows[k][0].ToString()))) {
								rcvWriteoff += PIn.Decimal(TableCapWriteoff.Rows[k][1].ToString());
							}
						}
						for(int k = 0;k < TableAdj.Rows.Count;k++) {
							if(dates[i] == (PIn.Date(TableAdj.Rows[k][0].ToString()))) {
								rcvAdj += PIn.Decimal(TableAdj.Rows[k][1].ToString());
							}
						}
						for(int k = 0;k < TableInsWriteoff.Rows.Count;k++) {
							if(dates[i] == (PIn.Date(TableInsWriteoff.Rows[k][0].ToString()))) {
								rcvWriteoff += PIn.Decimal(TableInsWriteoff.Rows[k][1].ToString());
							}
						}
						for(int k = 0;k < TablePay.Rows.Count;k++) {
							if(dates[i] == (PIn.Date(TablePay.Rows[k][0].ToString()))) {
								rcvPayment += PIn.Decimal(TablePay.Rows[k][1].ToString());
							}
						}
						for(int k = 0;k < TableIns.Rows.Count;k++) {
							if(dates[i] == (PIn.Date(TableIns.Rows[k][0].ToString()))) {
								rcvInsPayment += PIn.Decimal(TableIns.Rows[k][1].ToString());
							}
						}
						//rcvPayPlanCharges will be 0 if not on version 2.
						rcvDaily = (rcvProd + rcvPayPlanCharges + rcvAdj - rcvWriteoff) - (rcvPayment + rcvInsPayment);
						runningRcv += (rcvProd + rcvPayPlanCharges + rcvAdj - rcvWriteoff) - (rcvPayment + rcvInsPayment);
						row["Charges"] = rcvProd.ToString("n");
						row["PayPlanCharges"] = rcvPayPlanCharges.ToString("n");
						row["Adjustments"] = rcvAdj.ToString("n");
						row["Writeoffs"] = rcvWriteoff.ToString("n");
						row["Payment"] = rcvPayment.ToString("n");
						row["InsPayment"] = rcvInsPayment.ToString("n");
						row["Daily"] = rcvDaily.ToString("n");
						row["Running"] = runningRcv.ToString("n");
						colTotals[1] += rcvProd;
						colTotals[2] += rcvPayPlanCharges;
						colTotals[3] += rcvAdj;
						colTotals[4] += rcvWriteoff;
						colTotals[5] += rcvPayment;
						colTotals[6] += rcvInsPayment;
						colTotals[7] += rcvDaily;
						colTotals[8] = runningRcv;
						TableQ.Rows.Add(row);  //adds row to table Q
						rcvAdj = 0;
						rcvInsPayment = 0;
						rcvPayment = 0;
						rcvProd = 0;
						rcvPayPlanCharges = 0;
						rcvWriteoff = 0;
					}
					//Drop the PayPlanCharges column if not version 2
					if(payPlanVersion!=2) {
						TableQ.Columns.RemoveAt(2);
					}
					////columnCount will get incremented on the second ColTotal call so we can use it in this way
					//if(payPlanVersion==2) {
					//	report.ColTotal[1]=PIn.Decimal(colTotals[1].ToString("n")); //prod
					//	report.ColTotal[2]=PIn.Decimal(colTotals[2].ToString("n")); //payplancharges
					//	report.ColTotal[3]=PIn.Decimal(colTotals[3].ToString("n")); //adjustment
					//	report.ColTotal[4]=PIn.Decimal(colTotals[4].ToString("n")); //writeoffs
					//	report.ColTotal[5]=PIn.Decimal(colTotals[5].ToString("n")); //payment
					//	report.ColTotal[6]=PIn.Decimal(colTotals[6].ToString("n")); //inspayment
					//	report.ColTotal[7]=PIn.Decimal(colTotals[7].ToString("n")); //daily
					//	report.ColTotal[8]=PIn.Decimal(colTotals[8].ToString("n")); //running
					//}
					//else {
					//	report.ColTotal[1]=PIn.Decimal(colTotals[1].ToString("n")); //prod
					//	report.ColTotal[2]=PIn.Decimal(colTotals[3].ToString("n")); //adjustment
					//	report.ColTotal[3]=PIn.Decimal(colTotals[4].ToString("n")); //writeoffs
					//	report.ColTotal[4]=PIn.Decimal(colTotals[5].ToString("n")); //payment
					//	report.ColTotal[5]=PIn.Decimal(colTotals[6].ToString("n")); //inspayment
					//	report.ColTotal[6]=PIn.Decimal(colTotals[7].ToString("n")); //daily
					//	report.ColTotal[7]=PIn.Decimal(colTotals[8].ToString("n")); //running
					//}
					Font font = new Font("Tahoma",9);
					Font boldFont = new Font("Tahoma",9,FontStyle.Bold);
					Font fontTitle = new Font("Tahoma",17,FontStyle.Bold);
					Font fontSubTitle = new Font("Tahoma",10,FontStyle.Bold);
					report.ReportName=Lan.g(this,"Receivables Breakdown");
					report.AddTitle("Title",Lan.g(this,"Receivables Breakdown"),fontTitle);
					report.AddSubTitle("PracticeTitle",PrefC.GetString(PrefName.PracticeTitle),fontSubTitle);
					report.AddSubTitle("Date SubTitle",date1.SelectionStart.ToString("d"),fontSubTitle);
					string provNames = "";
					for(int i=0;i<listProv.SelectedIndices.Count;i++) {
						if(hasAllProvs) {
							provNames = "All Providers";
							break;
						}
						if(i>0) {
							provNames+=", ";
						}
						provNames+=_listProvs[listProv.SelectedIndices[i]-1].Abbr;
					}
					report.AddSubTitle("Provider SubTitle",provNames);
					int[] summaryGroups1 = {1};
					QueryObject query=report.AddQuery(TableQ,Lan.g(this,"Date")+": "+DateTimeOD.Today.ToString("d"));
					query.AddColumn("Date",72,FieldValueType.Date);
					query.AddColumn("Production",80,FieldValueType.Number);
					query.GetColumnDetail("Production").ContentAlignment=ContentAlignment.MiddleRight;
					if(payPlanVersion==2) {
						query.AddColumn("PayPlan",80,FieldValueType.Number);
						query.GetColumnDetail("PayPlan").ContentAlignment=ContentAlignment.MiddleRight;
					}
					query.AddColumn("Adjustment",80,FieldValueType.Number);
					query.GetColumnDetail("Adjustment").ContentAlignment=ContentAlignment.MiddleRight;
					query.AddColumn("Writeoff",80,FieldValueType.Number);
					query.GetColumnDetail("Writeoff").ContentAlignment=ContentAlignment.MiddleRight;
					query.AddColumn("Payment",80,FieldValueType.Number);
					query.GetColumnDetail("Payment").ContentAlignment=ContentAlignment.MiddleRight;
					query.AddColumn("InsPayment",80,FieldValueType.Number);
					query.GetColumnDetail("InsPayment").ContentAlignment=ContentAlignment.MiddleRight;
					query.AddColumn("Daily A/R",100,FieldValueType.Number);
					query.GetColumnDetail("Daily A/R").ContentAlignment=ContentAlignment.MiddleRight;
					query.AddColumn("Ending A/R",100);
					query.GetColumnDetail("Ending A/R").ContentAlignment=ContentAlignment.MiddleRight;
					query.GetColumnDetail("Ending A/R").Font=boldFont;
					report.AddFooterText("Desc","Receivables Calculation: (Production + PayPlanCharges + Adjustments - Writeoffs) - (Payments + Insurance Payments)",font,0,ContentAlignment.MiddleRight);
					//report.AddText("EndingAR","Final Ending A/R: "+runningRcv.ToString(),boldFont,0,ContentAlignment.MiddleLeft);
					report.AddPageNum(font);
					if(!report.SubmitQueries()) {
						return;
					}
					FormReportComplex FormR=new FormReportComplex(report);
					FormR.ShowDialog();
					DialogResult = DialogResult.OK;
				}//END If 
			}// END For Loop
		}//END OK button Clicked
Exemple #4
0
        private void FillListTree()
        {
            List <long> listExpandedDefNums = new List <long>();

            if (treeNotes.Nodes.Count == 0 && _userOdCurPref != null)         //if this is the fill on load, the node count will be 0, expanded node list from pref
            {
                listExpandedDefNums = _userOdCurPref.ValueString.Split(',').Where(x => x != "" && x != "0").Select(x => PIn.Long(x)).ToList();
            }
            else              //either not fill on load or no user pref, store the expanded node state to restore after filling tree
                              //only defs (category folders) can be expanded or have children nodes
            {
                listExpandedDefNums = treeNotes.Nodes.OfType <TreeNode>().SelectMany(x => GetNodeAndChildren(x))
                                      .Where(x => x.IsExpanded && x.Tag is Def).Select(x => ((Def)x.Tag).DefNum).ToList();
            }
            TreeNode selectedNode = treeNotes.SelectedNode;
            TreeNode topNode      = null;
            string   topNodePath  = treeNotes.TopNode?.FullPath;

            treeNotes.BeginUpdate();
            treeNotes.Nodes.Clear();            //clear current tree contents
            _dictChildNodesForDefNum = Defs.GetDefsForCategory(DefCat.AutoNoteCats, true).GroupBy(x => x.ItemValue ?? "0")
                                       .ToDictionary(x => PIn.Long(x.Key), x => new NodeChildren()
            {
                ListChildDefNodes = x.Select(y => new TreeNode(y.ItemName, 0, 0)
                {
                    Tag = y
                }).ToList()
            });
            Dictionary <long, List <TreeNode> > dictDefNumAutoNotes = AutoNotes.GetDeepCopy().GroupBy(x => x.Category)
                                                                      .ToDictionary(x => x.Key, x => x.Select(y => new TreeNode(y.AutoNoteName, 1, 1)
            {
                Tag = y
            }).ToList());

            foreach (KeyValuePair <long, List <TreeNode> > kvp in dictDefNumAutoNotes)
            {
                if (_dictChildNodesForDefNum.ContainsKey(kvp.Key))
                {
                    _dictChildNodesForDefNum[kvp.Key].ListAutoNoteNodes = kvp.Value;
                }
                else
                {
                    _dictChildNodesForDefNum[kvp.Key] = new NodeChildren()
                    {
                        ListAutoNoteNodes = kvp.Value
                    };
                }
            }
            List <TreeNode> listNodes = new List <TreeNode>();        //all nodes to add to tree, categories and autonotes
            NodeChildren    nodeChildren;

            if (_dictChildNodesForDefNum.TryGetValue(0, out nodeChildren))
            {
                nodeChildren.ListChildDefNodes.ForEach(SetAllDescendantsForNode);
                listNodes.AddRange(nodeChildren.ListChildDefNodes);
                listNodes.AddRange(nodeChildren.ListAutoNoteNodes);
            }
            treeNotes.Nodes.AddRange(listNodes.OrderBy(x => x, new NodeSorter()).ToArray());           //add node list to tree, after sorting
            List <TreeNode> listNodesCur = listNodes.SelectMany(x => GetNodeAndChildren(x)).ToList();  //get flat list of all nodes, copy entire tree

            foreach (TreeNode nodeCur in listNodesCur)
            {
                if (!string.IsNullOrEmpty(topNodePath) && nodeCur.FullPath == topNodePath)
                {
                    topNode = nodeCur;
                }
                if (nodeCur.Tag is Def && listExpandedDefNums.Contains(((Def)nodeCur.Tag).DefNum))
                {
                    nodeCur.Expand();
                }
                if (selectedNode == null)
                {
                    continue;
                }
                if (Equals(nodeCur, selectedNode))
                {
                    treeNotes.SelectedNode = nodeCur;
                }
            }
            treeNotes.TopNode = topNode;
            if (topNode == null && treeNotes.Nodes.Count > 0)
            {
                treeNotes.TopNode = treeNotes.SelectedNode ?? treeNotes.Nodes[0];
            }
            treeNotes.EndUpdate();
            treeNotes.Focus();
        }
        ///<summary></summary>
        public static void Reformat()
        {
            string oldTel;
            string newTel;
            string idNum;

            Queries.CurReport.Query = "select * from patient";
            Queries.SubmitCur();
            for (int i = 0; i < Queries.TableQ.Rows.Count; i++)
            {
                idNum = PIn.PString(Queries.TableQ.Rows[i][0].ToString());
                //home
                oldTel = PIn.PString(Queries.TableQ.Rows[i][15].ToString());
                newTel = TelephoneNumbers.ReFormat(oldTel);
                if (oldTel != newTel)
                {
                    Queries.CurReport.Query = "UPDATE patient SET hmphone = '"
                                              + POut.PString(newTel) + "' WHERE patNum = '" + idNum + "'";

                    Queries.SubmitNonQ();
                }
                //wk:
                oldTel = PIn.PString(Queries.TableQ.Rows[i][16].ToString());
                newTel = TelephoneNumbers.ReFormat(oldTel);
                if (oldTel != newTel)
                {
                    Queries.CurReport.Query = "UPDATE patient SET wkphone = '"
                                              + POut.PString(newTel) + "' WHERE patNum = '" + idNum + "'";
                    Queries.SubmitNonQ();
                }
                //wireless
                oldTel = PIn.PString(Queries.TableQ.Rows[i][17].ToString());
                newTel = TelephoneNumbers.ReFormat(oldTel);
                if (oldTel != newTel)              // Keyush Shah 04/21/04 Bug, was overwriting wireless with work phone here
                {
                    Queries.CurReport.Query = "UPDATE patient SET wirelessphone = '"
                                              + POut.PString(newTel) + "' WHERE patNum = '" + idNum + "'";
                    Queries.SubmitNonQ();
                }
            }
            Queries.CurReport.Query = "select * from carrier";
            Queries.SubmitCur();
            for (int i = 0; i < Queries.TableQ.Rows.Count; i++)
            {
                idNum = PIn.PString(Queries.TableQ.Rows[i][0].ToString());
                //ph
                oldTel = PIn.PString(Queries.TableQ.Rows[i][7].ToString());
                newTel = TelephoneNumbers.ReFormat(oldTel);
                if (oldTel != newTel)
                {
                    Queries.CurReport.Query = "UPDATE carrier SET Phone = '"
                                              + POut.PString(newTel) + "' WHERE CarrierNum = '" + idNum + "'";
                    Queries.SubmitNonQ();
                }
            }
            //this last part will only be run once during conversion to 2.8. It can be dropped from a future version.

            /*Queries.CurReport.Query="select * from insplan";
             * Queries.SubmitCur();
             * for(int i=0;i<Queries.TableQ.Rows.Count;i++){
             *      idNum=PIn.PString(Queries.TableQ.Rows[i][0].ToString());
             *      //ph
             *      oldTel=PIn.PString(Queries.TableQ.Rows[i][5].ToString());
             *      newTel=TelephoneNumbers.ReFormat(oldTel);
             *      if(oldTel!=newTel){
             *              Queries.CurReport.Query="UPDATE insplan SET Phone = '"
             +newTel+"' WHERE PlanNum = '"+idNum+"'";
             *              Queries.SubmitNonQ();
             *      }
             * }*/
        }        //reformat
 private void voidPaymentToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (!Security.IsAuthorized(Permissions.PaymentCreate))
     {
         return;
     }
     if (gridMain.SelectedIndices.Length < 1 ||
         !MsgBox.Show(this, MsgBoxButtons.YesNo, "Void this payment?"))
     {
         return;
     }
     try {
         Cursor = Cursors.WaitCursor;
         if (IsXWebTransaction(gridMain.SelectedIndices[0]))
         {
             long   patNum      = PIn.Long(_tableTrans.Rows[gridMain.SelectedIndices[0]]["PatNum"].ToString());
             long   responseNum = PIn.Long(_tableTrans.Rows[gridMain.SelectedIndices[0]]["ResponseNum"].ToString());
             string payNote     = Lan.g(this, "Void XWeb payment made from within Open Dental") + "\r\n"
                                  + Lan.g(this, "Amount:") + " " + PIn.Double(_tableTrans.Rows[gridMain.SelectedIndices[0]]["Amount"].ToString()).ToString("f") + "\r\n"
                                  + Lan.g(this, "Transaction ID:") + " " + _tableTrans.Rows[gridMain.SelectedIndices[0]]["TransactionID"].ToString() + "\r\n"
                                  + Lan.g(this, "Card Number:") + " " + _tableTrans.Rows[gridMain.SelectedIndices[0]]["MaskedAcctNum"].ToString() + "\r\n"
                                  + Lan.g(this, "Processed:") + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
             XWebs.VoidPayment(patNum, payNote, responseNum);
         }
         else
         {
             Payment payment = Payments.GetPayment(PIn.Long(_tableTrans.Rows[gridMain.SelectedIndices[0]]["PaymentNum"].ToString()));
             PayConnectResponseWeb pcResponseWeb = PayConnectResponseWebs.GetOne(PIn.Long(_tableTrans.Rows[gridMain.SelectedIndices[0]]["ResponseNum"].ToString()));
             decimal amt    = PIn.Decimal(_tableTrans.Rows[gridMain.SelectedIndices[0]]["Amount"].ToString());
             string  refNum = _tableTrans.Rows[gridMain.SelectedIndices[0]]["TransactionID"].ToString();                  //This is actually PayConnectResponseWeb.RefNumber, it's just stored in the TransactionID column
             if (!PayConnectL.VoidOrRefundPayConnectPortalTransaction(pcResponseWeb, payment, PayConnectService.transType.VOID, refNum, amt))
             {
                 Cursor = Cursors.Default;
                 return;
             }
         }
         Cursor = Cursors.Default;
         MsgBox.Show(this, "Void successful");
         FillGrid();
     }
     catch (ODException ex) {
         Cursor = Cursors.Default;
         MessageBox.Show(ex.Message);
     }
 }
        private void butClose_Click(object sender, System.EventArgs e)
        {
            if (textReportComputerName.Text.Trim().ToLower() == "localhost" || textReportComputerName.Text.Trim() == "127.0.0.1")
            {
                MsgBox.Show(this, "Computer name to fetch new reports from cannot be localhost or 127.0.0.1 or any other loopback address.");
                return;
            }
            int reportCheckIntervalMinuteCount = 0;

            try {
                reportCheckIntervalMinuteCount = PIn.Int(textReportCheckInterval.Text);
                if (textReportCheckInterval.Enabled && (reportCheckIntervalMinuteCount < 5 || reportCheckIntervalMinuteCount > 60))
                {
                    throw new ApplicationException("Invalid value.");                    //User never sees this message.
                }
            }
            catch {
                MsgBox.Show(this, "Report check interval must be between 5 and 60 inclusive.");
                return;
            }
            if (radioTime.Checked && (textReportCheckTime.Text == "" || !textReportCheckTime.IsValid))
            {
                MsgBox.Show(this, "Please enter a time to receive reports.");
                return;
            }
            bool doRestartToShowChanges = false;
            bool doInvalidateCache      = false;

            if (Prefs.UpdateString(PrefName.ClaimReportComputerName, textReportComputerName.Text))
            {
                doRestartToShowChanges = true;
                //No point in invalidating prefs since this only affects a workstation on startup.
            }
            if (Prefs.UpdateInt(PrefName.ClaimReportReceiveInterval, reportCheckIntervalMinuteCount))
            {
                doInvalidateCache = true;
            }
            if (radioTime.Checked)
            {
                if (Prefs.UpdateDateT(PrefName.ClaimReportReceiveTime, PIn.DateT(textReportCheckTime.Text)))
                {
                    doInvalidateCache = true;
                }
            }
            else if (textReportCheckTime.Text == "" && Prefs.UpdateDateT(PrefName.ClaimReportReceiveTime, DateTime.MinValue))
            {
                doInvalidateCache = true;
            }
            if (Prefs.UpdateBool(PrefName.ClaimReportReceivedByService, checkReceiveReportsService.Checked))
            {
                if (checkReceiveReportsService.Checked)
                {
                    doInvalidateCache = true;
                }
                else
                {
                    doRestartToShowChanges = true;
                }
            }
            if (doRestartToShowChanges)
            {
                MsgBox.Show(this, "You will need to restart the program for changes to take effect.");
            }
            if (doInvalidateCache)
            {
                DataValid.SetInvalid(InvalidType.Prefs);
            }
            Close();
        }
 private void gridMain_CellClick(object sender, ODGridClickEventArgs e)
 {
     GotoModule.GotoChart(PIn.Long(table.Rows[e.Row]["PatNum"].ToString()));
 }
Exemple #9
0
        ///<summary>Fills grid based on values in _listEtrans.
        ///Set isRefreshNeeded to true when we need to reinitialize local dictionarys after in memory list is also updated. Required true for first time running.
        ///Also allows you to passed in predetermined filter options.</summary>
        private void FillGrid(bool isRefreshNeeded, List <string> listSelectedStatuses, List <long> listSelectedClinicNums,
                              string carrierName, string checkTraceNum, string amountMin, string amountMax)
        {
            Cursor = Cursors.WaitCursor;
            Action actionCloseProgress = null;

            if (isRefreshNeeded)
            {
                actionCloseProgress = ODProgressOld.ShowProgressStatus("Etrans835", this, Lan.g(this, "Gathering data") + "...", false);
                _dictEtrans835s.Clear();
                _dictEtransClaims.Clear();
                _dictClaimPayExists.Clear();
                List <Etrans835Attach>    listAttached        = Etrans835Attaches.GetForEtrans(_listEtranss.Select(x => x.EtransNum).ToArray());
                Dictionary <long, string> dictEtransMessages  = new Dictionary <long, string>();
                List <X12ClaimMatch>      list835ClaimMatches = new List <X12ClaimMatch>();
                Dictionary <long, int>    dictClaimMatchCount = new Dictionary <long, int>(); //1:1 with _listEtranss. Stores how many claim matches each 835 has.
                int batchQueryInterval = 500;                                                 //Every 500 rows we get the next 500 message texts to save memory.
                int rowCur             = 0;
                foreach (Etrans etrans in _listEtranss)
                {
                    if (rowCur % batchQueryInterval == 0)
                    {
                        int range = Math.Min(batchQueryInterval, _listEtranss.Count - rowCur);                   //Either the full batchQueryInterval amount or the remaining amount of etrans.
                        dictEtransMessages = EtransMessageTexts.GetMessageTexts(_listEtranss.GetRange(rowCur, range).Select(x => x.EtransMessageTextNum).ToList(), false);
                    }
                    rowCur++;
                    ODEvent.Fire(new ODEventArgs("Etrans835", Lan.g(this, "Processing 835: ") + ": " + rowCur + " out of " + _listEtranss.Count));
                    List <Etrans835Attach> listAttachedTo835 = listAttached.FindAll(x => x.EtransNum == etrans.EtransNum);
                    X835 x835 = new X835(etrans, dictEtransMessages[etrans.EtransMessageTextNum], etrans.TranSetId835, listAttachedTo835, true);
                    _dictEtrans835s.Add(etrans.EtransNum, x835);
                    List <X12ClaimMatch> listClaimMatches = x835.GetClaimMatches();
                    dictClaimMatchCount.Add(etrans.EtransNum, listClaimMatches.Count);
                    list835ClaimMatches.AddRange(listClaimMatches);
                }
                #region Set 835 unattached in batch and build _dictEtransClaims and _dictClaimPayCheckNums.
                ODEvent.Fire(new ODEventArgs("Etrans835", Lan.g(this, "Gathering internal claim matches.")));
                List <long> listClaimNums = Claims.GetClaimFromX12(list835ClaimMatches);             //Can return null.
                ODEvent.Fire(new ODEventArgs("Etrans835", Lan.g(this, "Building data sets.")));
                int         claimIndexCur        = 0;
                List <long> listMatchedClaimNums = new List <long>();
                foreach (Etrans etrans in _listEtranss)
                {
                    X835 x835 = _dictEtrans835s[etrans.EtransNum];
                    if (listClaimNums != null)
                    {
                        x835.SetClaimNumsForUnattached(listClaimNums.GetRange(claimIndexCur, dictClaimMatchCount[etrans.EtransNum]));
                    }
                    claimIndexCur += dictClaimMatchCount[etrans.EtransNum];
                    listMatchedClaimNums.AddRange(x835.ListClaimsPaid.FindAll(x => x.ClaimNum != 0).Select(x => x.ClaimNum).ToList());
                }
                List <Claim> listClaims = Claims.GetClaimsFromClaimNums(listMatchedClaimNums.Distinct().ToList());
                _dictClaimPayExists = ClaimPayments.HasClaimPayment(listMatchedClaimNums);              //Every claim num is associated to a bool. True when there is an existing claimPayment.
                foreach (Etrans etrans in _listEtranss)
                {
                    X835 x835 = _dictEtrans835s[etrans.EtransNum];
                    #region _dictEtransClaims, _dictClaimPayCheckNums
                    _dictEtransClaims.Add(etrans.EtransNum, new List <Claim>());
                    List <long>  listSubClaimNums = x835.ListClaimsPaid.FindAll(x => x.ClaimNum != 0).Select(y => y.ClaimNum).ToList();
                    List <Claim> listClaimsFor835 = listClaims.FindAll(x => listSubClaimNums.Contains(x.ClaimNum));
                    foreach (Hx835_Claim claim in x835.ListClaimsPaid)
                    {
                        Claim claimCur = listClaimsFor835.FirstOrDefault(x => x.ClaimNum == claim.ClaimNum);                    //Can be null.
                        if (claimCur == null && claim.IsAttachedToClaim && claim.ClaimNum == 0)
                        {
                            claimCur = new Claim();                          //Create empty claim since user detached claim manually, will not be considered in GetStringStatus(...).
                        }
                        if (claimCur != null && claim.IsPreauth)             //User attached preauth to internal claim, no payment needed to be considered 'Finalized' in GetStringStatus(...).
                        {
                            _dictClaimPayExists[claim.ClaimNum] = true;
                        }
                        _dictEtransClaims[etrans.EtransNum].Add(claimCur);
                    }
                    #endregion
                }
                ODEvent.Fire(new ODEventArgs("Etrans835", Lan.g(this, "Filling Grid.")));
                #endregion
            }
            gridMain.BeginUpdate();
            #region Initilize columns only once
            if (gridMain.Columns.Count == 0)
            {
                ODGridColumn col;
                col = new ODGridColumn(Lan.g("TableEtrans835s", "Patient Name"), 250);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableEtrans835s", "Carrier Name"), 190);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableEtrans835s", "Status"), 80);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableEtrans835s", "Date"), 80);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableEtrans835s", "Amount"), 80);
                gridMain.Columns.Add(col);
                if (PrefC.HasClinicsEnabled)
                {
                    col = new ODGridColumn(Lan.g("TableEtrans835s", "Clinic"), 70);
                    gridMain.Columns.Add(col);
                }
                col = new ODGridColumn(Lan.g("TableEtrans835s", "Code"), 37, HorizontalAlignment.Center);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("TableEtrans835s", "Note"), 0);
                gridMain.Columns.Add(col);
            }
            #endregion
            gridMain.Rows.Clear();
            foreach (Etrans etrans in _listEtranss)
            {
                X835 x835 = _dictEtrans835s[etrans.EtransNum];
                #region Filter: Carrier Name
                if (carrierName != "" && !x835.PayerName.ToLower().Contains(carrierName.ToLower()))
                {
                    continue;
                }
                #endregion
                string status = GetStringStatus(etrans.EtransNum);
                #region Filter: Status
                if (!listSelectedStatuses.Contains(status.Replace("*", "")))                //The filter will ignore finalized with detached claims.
                {
                    continue;
                }
                #endregion
                //List of ClinicNums for the current etrans.ListClaimsPaid from the DB.
                List <long> listClinicNums = _dictEtransClaims[etrans.EtransNum].Select(x => x == null? 0 :x.ClinicNum).Distinct().ToList();
                #region Filter: Clinics
                if (PrefC.HasClinicsEnabled && !listClinicNums.Exists(x => listSelectedClinicNums.Contains(x)))
                {
                    continue;                    //The ClinicNums associated to the 835 do not match any of the selected ClinicNums, so nothing to show in this 835.
                }
                #endregion
                #region Filter: Check and Trace Value
                if (checkTraceNum != "" && !x835.TransRefNum.Contains(checkTraceNum))               //Trace Number does not match
                {
                    continue;
                }
                #endregion
                #region Filter: Insurance Check Range Min and Max
                if (amountMin != "" && x835.InsPaid < PIn.Decimal(amountMin) || amountMax != "" && x835.InsPaid > PIn.Decimal(amountMax))
                {
                    continue;                    //Either the InsPaid is below or above our range.
                }
                #endregion
                ODGridRow row = new ODGridRow();
                #region Column: Patient Name
                List <string> listPatNames = x835.ListClaimsPaid.Select(x => x.PatientName.ToString()).Distinct().ToList();
                string        patName      = (listPatNames.Count > 0 ? listPatNames[0] : "");
                if (listPatNames.Count > 1)
                {
                    patName = "(" + POut.Long(listPatNames.Count) + ")";
                }
                row.Cells.Add(patName);
                #endregion
                row.Cells.Add(x835.PayerName);
                row.Cells.Add(status);                //See GetStringStatus(...) for possible values.
                row.Cells.Add(POut.Date(etrans.DateTimeTrans));
                row.Cells.Add(POut.Decimal(x835.InsPaid));
                #region Column: Clinic
                if (PrefC.HasClinicsEnabled)
                {
                    string clinicAbbr = "";
                    if (listClinicNums.Count == 1)
                    {
                        if (listClinicNums[0] == 0)
                        {
                            clinicAbbr = Lan.g(this, "Unassigned");
                        }
                        else
                        {
                            clinicAbbr = Clinics.GetAbbr(listClinicNums[0]);
                        }
                    }
                    else if (listClinicNums.Count > 1)
                    {
                        clinicAbbr = "(" + Lan.g(this, "Multiple") + ")";
                    }
                    row.Cells.Add(clinicAbbr);
                }
                #endregion
                row.Cells.Add(x835._paymentMethodCode);
                row.Cells.Add(etrans.Note);
                row.Tag = etrans;
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            try {
                actionCloseProgress?.Invoke();                //When this function executes quickly this can fail rarely, fail silently because of WaitCursor.
            }
            catch (Exception ex) {
                ex.DoNothing();
            }
            Cursor = Cursors.Default;
        }
Exemple #10
0
        ///<summary>Set all fields of this control. This is an alternative to constructing an entirely new instance.
        ///All uses of this control currently construct as Visible=false so that is the default here.</summary>
        public void ResetData(DataRow rowApt, DataTable tableApptFields, DataTable tablePatFields, Point location, bool visible = false)
        {
            DataRoww        = rowApt;
            TableApptFields = tableApptFields;
            TablePatFields  = tablePatFields;
            Pattern         = PIn.String(DataRoww["Pattern"].ToString());
            PatternShowing  = ApptSingleDrawing.GetPatternShowing(Pattern);
            Location        = location;
            Size            = ApptSingleDrawing.SetSize(Pattern);
            //These controls are always drawn as their Shadow bitmap.
            //They never actually render as a control.
            //Always set Visible to false here so that parent panel/form doesn't account for them when drawings it's controls.
            //In the case where it is a draggable control or on the pinboard, then it will be set to Visible=true.
            Visible = visible;
            //These are used heavily so deserialize here once to save time when accessing.
            AptNum           = PIn.Long(DataRoww["AptNum"].ToString());
            PatNum           = PIn.Long(DataRoww["PatNum"].ToString());
            AptDateTime      = PIn.DateT(DataRoww["AptDateTime"].ToString());
            OpNum            = PIn.Long(DataRoww["Op"].ToString());
            ClinicNum        = PIn.Long(DataRoww["ClinicNum"].ToString());
            ProvNum          = PIn.Long(DataRoww["ProvNum"].ToString());
            ProvHyg          = PIn.Long(DataRoww["ProvHyg"].ToString());
            Confirmed        = PIn.Long(DataRoww["Confirmed"].ToString());
            IsHygiene        = PIn.Bool(DataRoww["IsHygiene"].ToString());
            GrossProduction  = PIn.Decimal(DataRoww["productionVal"].ToString());
            WriteoffPPO      = PIn.Decimal(DataRoww["writeoffPPO"].ToString());
            AdjustmentTotal  = PIn.Decimal(DataRoww["adjustmentTotal"].ToString());
            ImageFolder      = PIn.String(DataRoww["ImageFolder"].ToString());
            PatientName      = PIn.String(DataRoww["patientName"].ToString());
            AptDate          = PIn.String(DataRoww["aptDate"].ToString());
            AptDay           = PIn.String(DataRoww["aptDay"].ToString());
            AptLength        = PIn.String(DataRoww["aptLength"].ToString());
            AptTime          = PIn.String(DataRoww["aptTime"].ToString());
            Email            = PIn.String(DataRoww["Email"].ToString());
            Language         = PIn.String(DataRoww["language"].ToString());
            ReferralTo       = PIn.String(DataRoww["referralTo"].ToString());
            ReferralFrom     = PIn.String(DataRoww["referralFrom"].ToString());
            ApptModNote      = PIn.String(DataRoww["apptModNote"].ToString());
            FamFinUrgNote    = PIn.String(DataRoww["famFinUrgNote"].ToString());
            AddrNote         = PIn.String(DataRoww["addrNote"].ToString());
            Insurance        = PIn.String(DataRoww["insurance"].ToString());
            ContactMethods   = PIn.String(DataRoww["contactMethods"].ToString());
            WirelessPhone    = PIn.String(DataRoww["wirelessPhone"].ToString());
            WkPhone          = PIn.String(DataRoww["wkPhone"].ToString());
            HmPhone          = PIn.String(DataRoww["hmPhone"].ToString());
            Age              = PIn.String(DataRoww["age"].ToString());
            BillingType      = PIn.String(DataRoww["billingType"].ToString());
            ChartNumber      = PIn.String(DataRoww["chartNumber"].ToString());
            Note             = PIn.String(DataRoww["Note"].ToString());
            Procs            = PIn.String(DataRoww["procs"].ToString());
            Lab              = PIn.String(DataRoww["lab"].ToString());
            MedUrgNote       = PIn.String(DataRoww["MedUrgNote"].ToString());
            PreMedFlag       = PIn.String(DataRoww["preMedFlag"].ToString());
            ConfirmedFromDef = PIn.String(DataRoww["confirmed"].ToString());
            Production       = PIn.String(DataRoww["production"].ToString());
            Provider         = PIn.String(DataRoww["provider"].ToString());
            ApptStatus aptStatus;

            if (Enum.TryParse(PIn.String(DataRoww["AptStatus"].ToString()), out aptStatus))
            {
                AptStatus = aptStatus;
            }
            else
            {
                AptStatus = ApptStatus.None;
            }
            ApptPriority priority;

            if (Enum.TryParse(PIn.String(DataRoww["Priority"].ToString()), out priority))
            {
                Priority = priority;
            }
            else
            {
                Priority = ApptPriority.Normal;
            }
        }
        private void FillGrid()
        {
            if (textDateStart.errorProvider1.GetError(textDateStart) != "")
            {
                return;
            }
            DateTime dateSince;

            if (textDateStart.Text.Trim() == "")
            {
                dateSince = DateTime.MinValue;
            }
            else
            {
                dateSince = PIn.Date(textDateStart.Text);
            }
            int    monthStart = comboMonthStart.SelectedIndex;
            double aboveAmount;

            if (textOverAmount.errorProvider1.GetError(textOverAmount) != "")
            {
                return;
            }
            if (textOverAmount.Text.Trim() != "")
            {
                aboveAmount = PIn.Double(textOverAmount.Text);
            }
            else
            {
                aboveAmount = 0;
            }
            ArrayList provFilter = new ArrayList();
            ArrayList billFilter = new ArrayList();

            if (comboBoxMultiProv.SelectedIndices[0].ToString() != "0")
            {
                provFilter = comboBoxMultiProv.SelectedIndices;
            }
            if (comboBoxMultiBilling.SelectedIndices[0].ToString() != "0")
            {
                billFilter = comboBoxMultiBilling.SelectedIndices;
            }
            string code1 = "";
            string code2 = "";

            if (textCodeRange.Text.Trim() != "")
            {
                if (textCodeRange.Text.Contains("-"))
                {
                    string[] codeSplit = textCodeRange.Text.Split('-');
                    code1 = codeSplit[0].Trim();
                    code2 = codeSplit[1].Trim();
                }
                else
                {
                    code1 = textCodeRange.Text.Trim();
                    code2 = textCodeRange.Text.Trim();
                }
            }
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            //0=PatNum
            ODGridColumn col = new ODGridColumn(Lan.g("TableTreatmentFinder", "LName"), 100);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableTreatmentFinder", "FName"), 100);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableTreatmentFinder", "Contact"), 120);
            gridMain.Columns.Add(col);
            //4=address
            //5=cityStateZip
            col           = new ODGridColumn(Lan.g("TableTreatmentFinder", "Annual Max"), 70);
            col.TextAlign = HorizontalAlignment.Right;
            gridMain.Columns.Add(col);
            col           = new ODGridColumn(Lan.g("TableTreatmentFinder", "Amt Used"), 70);
            col.TextAlign = HorizontalAlignment.Right;
            gridMain.Columns.Add(col);
            col           = new ODGridColumn(Lan.g("TableTreatmentFinder", "Amt Pend"), 70);
            col.TextAlign = HorizontalAlignment.Right;
            gridMain.Columns.Add(col);
            col           = new ODGridColumn(Lan.g("TableTreatmentFinder", "Amt Rem"), 70);
            col.TextAlign = HorizontalAlignment.Right;
            gridMain.Columns.Add(col);
            col           = new ODGridColumn(Lan.g("TableTreatmentFinder", "Treat Plan"), 70);
            col.TextAlign = HorizontalAlignment.Right;
            gridMain.Columns.Add(col);
            col           = new ODGridColumn(Lan.g("TableTreatmentFinder", "Insurance Carrier"), 225);
            col.TextAlign = HorizontalAlignment.Left;
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            Cursor = Cursors.WaitCursor;
            table  = Patients.GetTreatmentFinderList(checkIncludeNoIns.Checked, checkIncludePatsWithApts.Checked, monthStart, dateSince, aboveAmount, provFilter, billFilter, code1, code2);
            ODGridRow row;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                row = new ODGridRow();
                //Temporary filter just showing columns wanted. Probable it will become user defined.
                for (int j = 0; j < table.Columns.Count; j++)
                {
                    if (j == 0 || j == 4 || j == 5)               //PatNum,address,cityStateZip are just for the export report.
                    {
                        continue;
                    }
                    if (j == 6 && PIn.Double(table.Rows[i][j].ToString()) == 0)
                    {
                        row.Cells.Add("");                        //don't show annual max for patients without ins or patients without annual max
                        continue;
                    }
                    if (j == 9 && PIn.Double(table.Rows[i][6].ToString()) == 0) //if annualmax is 0
                    {
                        row.Cells.Add("");                                      //don't show amount remaining if no annual max
                        continue;
                    }
                    row.Cells.Add(table.Rows[i][j].ToString());
                }
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            Cursor = Cursors.Default;
        }
Exemple #12
0
        private void FillGrid()
        {
            if (textDateTo.errorProvider1.GetError(textDateTo) != "" || textDateFrom.errorProvider1.GetError(textDateFrom) != "")               //Test To and From dates
            {
                MsgBox.Show(this, "Please enter valid To and From dates.");
                return;
            }
            DateFrom = PIn.Date(textDateFrom.Text);
            DateTo   = PIn.Date(textDateTo.Text);
            if (DateTo < DateFrom)
            {
                MsgBox.Show(this, "Date To cannot be before Date From.");
                return;
            }
//todo: checkbox
            RefAttachList = RefAttaches.RefreshForReferralProcTrack(DateFrom, DateTo, checkComplete.Checked);
            Table         = Procedures.GetReferred(DateFrom, DateTo, checkComplete.Checked);
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col;

            col = new GridColumn(Lan.g(this, "Patient"), 125);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Referred To"), 125);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Description"), 125);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Note"), 125);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Date Referred"), 86);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Date Done"), 86);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Status"), 84);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            GridRow  row;
            DateTime date;

            for (int i = 0; i < Table.Rows.Count; i++)
            {
                row = new GridRow();
                row.Cells.Add(Patients.GetPat(PIn.Long(Table.Rows[i]["PatNum"].ToString())).GetNameLF());
                row.Cells.Add(Table.Rows[i]["LName"].ToString() + ", " + Table.Rows[i]["FName"].ToString() + " " + Table.Rows[i]["MName"].ToString());
                row.Cells.Add(ProcedureCodes.GetLaymanTerm(PIn.Long(Table.Rows[i]["CodeNum"].ToString())));
                row.Cells.Add(Table.Rows[i]["Note"].ToString());
                date = PIn.Date(Table.Rows[i]["RefDate"].ToString());
                if (date.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(date.ToShortDateString());
                }
                date = PIn.Date(Table.Rows[i]["DateProcComplete"].ToString());
                if (date.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(date.ToShortDateString());
                }
                ReferralToStatus refStatus = (ReferralToStatus)PIn.Int(Table.Rows[i]["RefToStatus"].ToString());
                if (refStatus == ReferralToStatus.None)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(refStatus.ToString());
                }
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }
        private void butAddOrUpdate_Click(object sender, EventArgs e)
        {
            List <PayPlanEdit.PayPlanEntry> listSelectedEntries = new List <PayPlanEdit.PayPlanEntry>();

            for (int i = 0; i < gridMain.SelectedIndices.Count(); i++)          //add all of the currently selected entries to this list.
            {
                listSelectedEntries.Add((PayPlanEdit.PayPlanEntry)(gridMain.ListGridRows[gridMain.SelectedIndices[i]].Tag));
            }
            if (listSelectedEntries.Count <= 1)            //validation (doesn't matter if multiple are selected)
            {
                if (string.IsNullOrEmpty(textAmt.Text) || textAmt.errorProvider1.GetError(textAmt) != "" || PIn.Double(textAmt.Text) == 0)
                {
                    MsgBox.Show(this, "Please enter a valid amount.");
                    return;
                }
                if (textDate.Text != "" && textDate.errorProvider1.GetError(textDate) != "")
                {
                    MsgBox.Show(this, "Please enter a valid date.");
                    return;
                }
            }
            if (textDate.Text == "")
            {
                textDate.Text = DateTime.Today.ToShortDateString();
            }
            if (Security.IsGlobalDateLock(Permissions.PayPlanEdit, PIn.Date(textDate.Text)))
            {
                return;
            }
            if (listSelectedEntries.Count == 0)
            {
                if (PrefC.GetInt(PrefName.RigorousAccounting) == (int)RigorousAccounting.EnforceFully)                //if they have none selected
                {
                    MsgBox.Show(this, "All treatment credits (excluding adjustments) must have a procedure.");
                    return;
                }
                //add an unattached charge only if not on enforce fully
                PayPlanCharge addCharge = PayPlanEdit.CreateUnattachedCredit(textDate.Text, _patCur.PatNum, textNote.Text, _payPlanCur.PayPlanNum,
                                                                             PIn.Double(textAmt.Text));
                ListPayPlanCreditsCur.Add(addCharge);
            }
            else if (listSelectedEntries.Count == 1)            //if they have one selected
            {
                PayPlanEdit.PayPlanEntry selectedEntry = listSelectedEntries[0];
                if (selectedEntry.Proc != null && _listPayPlanLinksForProcs.Select(x => x.FKey).Contains(selectedEntry.Proc.ProcNum))
                {
                    MsgBox.Show(this, "This procedure is already linked to a dynamic payment plan.");
                    return;
                }
                if (PrefC.GetInt(PrefName.RigorousAccounting) == (int)RigorousAccounting.EnforceFully)
                {
                    if ((selectedEntry.Proc == null || selectedEntry.Proc.ProcNum == 0) &&
                        !(selectedEntry.Charge != null && selectedEntry.Charge.IsCreditAdjustment))
                    {
                        MsgBox.Show(this, "All treatment credits (excluding adjustments) must have a procedure.");
                        return;
                    }
                }
                PayPlanCharge selectedCharge = new PayPlanCharge();
                if (selectedEntry.IsChargeOrd)
                {
                    //get the charge from the grid.
                    //DO NOT use PayPlanChargeNum. They are not pre-inserted so they will all be 0 if new.
                    selectedCharge = ((PayPlanEdit.PayPlanEntry)(gridMain.ListGridRows[gridMain.SelectedIndices[0]].Tag)).Charge;
                }
                ListPayPlanCreditsCur = PayPlanEdit.CreateOrUpdateChargeForSelectedEntry(selectedEntry, ListPayPlanCreditsCur, PIn.Double(textAmt.Text), textNote.Text, textDate.Text
                                                                                         , _patCur.PatNum, _payPlanCur.PayPlanNum, selectedCharge);
            }
            else if (listSelectedEntries.Count > 1)            //if they have more than one entry selected
            //remove everythig that doesn't have a procnum from the list
            {
                List <PayPlanEdit.PayPlanEntry> listSelectedProcs = listSelectedEntries.Where(x => !x.IsChargeOrd).Where(x => x.Proc != null).ToList();
                if (listSelectedEntries.Count == 0)                //if the list is then empty, there's nothing to do.
                {
                    MsgBox.Show(this, "You must have at least one procedure selected.");
                    return;
                }
                if (!MsgBox.Show(this, MsgBoxButtons.OKCancel,
                                 "Add a payment plan credit for each of the selected procedure's remaining amount?  Selected credits will be ignored."))
                {
                    return;
                }
                List <PayPlanEdit.PayPlanEntry> listValidSelectedProcs =
                    listSelectedProcs.FindAll(x => !_listPayPlanLinksForProcs.Select(y => y.FKey).Contains(x.Proc.ProcNum));
                int countProcsSkipped = listSelectedProcs.Count - listValidSelectedProcs.Count;
                ListPayPlanCreditsCur = PayPlanEdit.CreateCreditsForAllSelectedEntries(listValidSelectedProcs, _listPayPlanEntries, DateTimeOD.Today
                                                                                       , _patCur.PatNum, _payPlanCur.PayPlanNum, ListPayPlanCreditsCur);
                if (countProcsSkipped > 0)
                {
                    MsgBox.Show(this, "Credits were not made for " + countProcsSkipped + " procedure(s) because they are linked to one or more dynamic payment plans.");
                }
            }
            textAmt.Text  = "";
            textDate.Text = "";
            textNote.Text = "";
            FillGrid();
            SetTextBoxes();
        }
Exemple #14
0
		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			FormEvaluationEdit FormEE=new FormEvaluationEdit(Evaluations.GetOne(PIn.Long(gridMain.ListGridRows[gridMain.GetSelectedIndex()].Tag.ToString())));
			FormEE.ShowDialog();
			FillGrid();
		}
Exemple #15
0
        private bool ValidateDunningFilters(Dunning dunning)
        {
            long clinicNum = GetSelectedClinicNum();

            if ((clinicNum != -1 && clinicNum != dunning.ClinicNum) ||
                (!listBill.SelectedIndices.Contains(0) && !listBill.SelectedIndices.OfType <int>().Select(x => _listBillingTypeDefs[x - 1].DefNum).Contains(dunning.BillingType)) ||
                (!radioAny.Checked && dunning.AgeAccount != (byte)(30 * new List <RadioButton> {
                radioAny, radio30, radio60, radio90
            }.FindIndex(x => x.Checked))) ||                                                                                                                                //0, 30, 60, or 90
                (!string.IsNullOrWhiteSpace(textAdv.Text) && dunning.DaysInAdvance != PIn.Int(textAdv.Text, false)) ||            //blank=0
                (!radioU.Checked && dunning.InsIsPending != (YN) new List <RadioButton> {
                radioU, radioY, radioN
            }.FindIndex(x => x.Checked)))                                                                                                                 //0=Unknown, 1=Yes, 2=No+
            {
                return(false);
            }
            return(true);
        }
        private void butOK_Click(object sender, System.EventArgs e)
        {
            //validate user input
            if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" ||
                textDateTo.errorProvider1.GetError(textDateTo) != "")
            {
                MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
                return;
            }
            if (textDateFrom.Text.Length == 0 ||
                textDateTo.Text.Length == 0)
            {
                MessageBox.Show(Lan.g(this, "From and To dates are required."));
                return;
            }
            DateTime dateFrom = PIn.PDate(textDateFrom.Text);
            DateTime dateTo   = PIn.PDate(textDateTo.Text);

            if (dateTo < dateFrom)
            {
                MessageBox.Show(Lan.g(this, "To date cannot be before From date."));
                return;
            }
            if (listProv.SelectedIndices.Count == 0)
            {
                MessageBox.Show(Lan.g(this, "You must select at least one provider."));
                return;
            }

            string whereProv;            //used as the provider portion of the where clauses.

            //each whereProv needs to be set up separately for each query
            whereProv = "appointment.ProvNum in (";
            for (int i = 0; i < listProv.SelectedIndices.Count; i++)
            {
                if (i > 0)
                {
                    whereProv += ",";
                }
                whereProv += "'" + POut.PInt(Providers.List[listProv.SelectedIndices[i]].ProvNum) + "'";
            }
            whereProv += ") ";
            //create the report
            ReportOld2 report = new ReportOld2();

            report.IsLandscape = true;
            report.ReportName  = "Appointments";
            report.AddTitle("Appointments");
            report.AddSubTitle(((Pref)PrefB.HList["PracticeTitle"]).ValueString);
            report.AddSubTitle(dateFrom.ToShortDateString() + " - " + dateTo.ToShortDateString());
            //setup query
            report.Query = @"SELECT appointment.AptDateTime, 
				trim(CONCAT(CONCAT(CONCAT(CONCAT(concat(patient.LName,', '),case when length(patient.Preferred) > 0 
				then CONCAT(concat('(',patient.Preferred),') ') else '' end),patient.fname), ' '),patient.middlei))
				AS PatName,
				patient.Birthdate,
				appointment.AptDateTime,
				length(appointment.Pattern)*5,
				appointment.ProcDescript,
				patient.HmPhone, patient.WkPhone, patient.WirelessPhone
				FROM appointment INNER JOIN patient ON appointment.PatNum = patient.PatNum
				WHERE appointment.AptDateTime between "                 + POut.PDate(dateFrom) + " AND "
                           + POut.PDate(dateTo.AddDays(1)) + " AND " +
                           "AptStatus != '" + (int)ApptStatus.UnschedList + "' AND " +
                           "AptStatus != '" + (int)ApptStatus.Planned + "' AND " +
                           whereProv + " " +
                           "ORDER BY appointment.AptDateTime, 2";
            // add columns to report
            report.AddColumn("Date", 75, FieldValueType.Date);
            report.GetLastRO(ReportObjectKind.FieldObject).SuppressIfDuplicate = true;
            report.GetLastRO(ReportObjectKind.FieldObject).FormatString        = "d";
            report.AddColumn("Patient", 175, FieldValueType.String);
            report.AddColumn("Age", 45, FieldValueType.Age);
            // remove the total column
            //if(report.ReportObjects[report.ReportObjects.Count-1].SummarizedField == "Age")
            //	report.ReportObjects.RemoveAt(report.ReportObjects.Count-1);
            //report.GetLastRO(ReportObjectKind.FieldObject).FormatString = "###0";
            //report.GetLastRO(ReportObjectKind.FieldObject).TextAlign = ContentAlignment.MiddleCenter;
            //report.GetLastRO(ReportObjectKind.TextObject).TextAlign = ContentAlignment.MiddleCenter;
            report.AddColumn("Time", 65, FieldValueType.Date);
            report.GetLastRO(ReportObjectKind.FieldObject).FormatString = "t";
            report.GetLastRO(ReportObjectKind.TextObject).TextAlign     = ContentAlignment.MiddleRight;
            report.GetLastRO(ReportObjectKind.FieldObject).TextAlign    = ContentAlignment.MiddleRight;
            report.AddColumn("Length", 60, FieldValueType.Integer);
            report.GetLastRO(ReportObjectKind.TextObject).Location = new Point(
                report.GetLastRO(ReportObjectKind.TextObject).Location.X + 6,
                report.GetLastRO(ReportObjectKind.TextObject).Location.Y);
            report.GetLastRO(ReportObjectKind.FieldObject).Location = new Point(
                report.GetLastRO(ReportObjectKind.FieldObject).Location.X + 8,
                report.GetLastRO(ReportObjectKind.FieldObject).Location.Y);
            report.AddColumn("Description", 170, FieldValueType.String);
            report.AddColumn("Home Ph.", 120, FieldValueType.String);
            report.AddColumn("Work Ph.", 120, FieldValueType.String);
            report.AddColumn("Cell Ph.", 120, FieldValueType.String);
            report.AddPageNum();
            // execute query
            if (!report.SubmitQuery())
            {
                return;
            }
            // display report
            FormReportOld2 FormR = new FormReportOld2(report);

            //FormR.MyReport=report;
            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
 private bool IsXWebTransaction(int selectedIndex)
 {
     return(PIn.Int(_tableTrans.Rows[selectedIndex]["isXWeb"].ToString()) == 1);
 }
Exemple #18
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            long             feeSched = FeeSchedC.ListShort[listFeeSched.SelectedIndex].FeeSchedNum;
            string           catName  = ""; //string to hold current category name
            Fees             fee      = new Fees();
            ReportSimpleGrid report   = new ReportSimpleGrid();

            report.Query = "SELECT procedurecode.ProcCode,fee.Amount,'     ',procedurecode.Descript,"
                           + "procedurecode.AbbrDesc FROM procedurecode,fee "
                           + "WHERE procedurecode.CodeNum=fee.CodeNum AND fee.FeeSched='" + feeSched.ToString()
                           + "' ORDER BY procedurecode.ProcCode";
            FormQuery2          = new FormQuery(report);
            FormQuery2.IsReport = true;
            if (radioCode.Checked == true)
            {
                FormQuery2.SubmitReportQuery();
                report.Title = "Procedure Codes";
                report.SubTitle.Add(PrefC.GetString(PrefName.PracticeTitle));
                report.SubTitle.Add(FeeScheds.GetDescription(feeSched));
                report.SetColumn(this, 0, "Code", 70);
                report.SetColumn(this, 1, "Fee Amount", 70, HorizontalAlignment.Right);
                report.SetColumn(this, 2, " ", 80);             //otherwise, the amount gets bunched up next to the description.
                report.SetColumn(this, 3, "Description", 200);
                report.SetColumn(this, 4, "Abbr Description", 200);
                FormQuery2.ShowDialog();
                DialogResult = DialogResult.OK;
            }
            else              //categories
            //report.SubmitTemp();//create TableTemp which is not actually used
            {
                ProcedureCode[] ProcList = ProcedureCodes.GetProcList();
                report.TableQ = new DataTable(null);
                for (int i = 0; i < 5; i++)                                  //add columns
                {
                    report.TableQ.Columns.Add(new System.Data.DataColumn()); //blank columns
                }
                report.InitializeColumns();
                DataRow row = report.TableQ.NewRow();//add first row by hand to get value for temp
                row[0]              = DefC.GetName(DefCat.ProcCodeCats, ProcList[0].ProcCat);
                catName             = row[0].ToString();
                row[1]              = ProcList[0].ProcCode;
                row[2]              = ProcList[0].Descript;
                row[3]              = ProcList[0].AbbrDesc;
                row[4]              = ((double)Fees.GetAmount0(ProcList[0].CodeNum, feeSched)).ToString("F");
                report.ColTotal[4] += PIn.Double(row[4].ToString());
                report.TableQ.Rows.Add(row);
                for (int i = 1; i < ProcList.Length; i++)          //loop through data rows
                {
                    row    = report.TableQ.NewRow();               //create new row called 'row' based on structure of TableQ
                    row[0] = DefC.GetName(DefCat.ProcCodeCats, ProcList[i].ProcCat);
                    if (catName == row[0].ToString())
                    {
                        row[0] = "";
                    }
                    else
                    {
                        catName = row[0].ToString();
                    }
                    row[1] = ProcList[i].ProcCode.ToString();
                    row[2] = ProcList[i].Descript;
                    row[3] = ProcList[i].AbbrDesc.ToString();
                    row[4] = ((double)Fees.GetAmount0(ProcList[i].CodeNum, feeSched)).ToString("F");
                    //report.ColTotal[4]+=PIn.PDouble(row[4].ToString());
                    report.TableQ.Rows.Add(row);
                }
                FormQuery2.ResetGrid();                //this is a method in FormQuery2;
                report.Title = "Procedure Codes";
                report.SubTitle.Add(PrefC.GetString(PrefName.PracticeTitle));
                report.SubTitle.Add(FeeScheds.GetDescription(feeSched));
                report.ColPos[0]     = 20;
                report.ColPos[1]     = 120;
                report.ColPos[2]     = 270;
                report.ColPos[3]     = 470;
                report.ColPos[4]     = 620;
                report.ColPos[5]     = 770;
                report.ColCaption[0] = "Category";
                report.ColCaption[1] = "Code";
                report.ColCaption[2] = "Description";
                report.ColCaption[3] = "Abbr Description";
                report.ColCaption[4] = "Fee Amount";
                report.ColAlign[4]   = HorizontalAlignment.Right;
                FormQuery2.ShowDialog();
                DialogResult = DialogResult.OK;
            }
        }
        private void FillGrid()
        {
            List <long> listClinicNums = new List <long>();

            if (PrefC.HasClinicsEnabled && comboClinic.SelectedIndex != 0)           //Not 'All' selected
            {
                if (Security.CurUser.ClinicIsRestricted)
                {
                    listClinicNums.Add(_listClinics[comboClinic.SelectedIndex - 1].ClinicNum);                  //Minus 1 for 'All'
                }
                else
                {
                    if (comboClinic.SelectedIndex == 1)                   //'Unassigned' selected
                    {
                        listClinicNums.Add(0);
                    }
                    else if (comboClinic.SelectedIndex > 1)
                    {
                        listClinicNums.Add(_listClinics[comboClinic.SelectedIndex - 2].ClinicNum);                      //Minus 2 for 'All' and 'Unassigned'
                    }
                }
            }
            else
            {
                //Send an empty list of clinics to get all transactions
            }
            DateTime dateFrom = PIn.Date(textDateFrom.Text);
            DateTime dateTo   = PIn.Date(textDateTo.Text);

            _tableTrans = XWebResponses.GetApprovedTransactions(listClinicNums, dateFrom, dateTo);
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col;

            col = new GridColumn(Lan.g(this, "Patient"), 120);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Amount"), 60, HorizontalAlignment.Right);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Date"), 80);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Tran Type"), 80);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Card Number"), 140);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Expiration"), 70);
            gridMain.ListGridColumns.Add(col);
            if (PrefC.HasClinicsEnabled)
            {
                col = new GridColumn(Lan.g(this, "Clinic"), 100);
                gridMain.ListGridColumns.Add(col);
            }
            col = new GridColumn(Lan.g(this, "Transaction ID"), 110);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            GridRow row;

            for (int i = 0; i < _tableTrans.Rows.Count; i++)
            {
                bool isXWeb = IsXWebTransaction(i);               //Only other option at the moment is PayConnect. This will need to be refactored if we add more payment options
                row = new GridRow();
                row.Cells.Add(_tableTrans.Rows[i]["Patient"].ToString());
                row.Cells.Add(PIn.Double(_tableTrans.Rows[i]["Amount"].ToString()).ToString("f"));
                row.Cells.Add(PIn.Date(_tableTrans.Rows[i]["DateTUpdate"].ToString()).ToShortDateString());
                if (isXWeb)
                {
                    XWebTransactionStatus tranStatus = (XWebTransactionStatus)PIn.Int(_tableTrans.Rows[i]["TransactionStatus"].ToString());
                    row.Cells.Add(GetXWebTranTypeByStatus(tranStatus));
                }
                else
                {
                    //This is actually the PayConnectResponseWeb.TransType
                    row.Cells.Add(_tableTrans.Rows[i]["TransactionStatus"].ToString());
                }
                row.Cells.Add(_tableTrans.Rows[i]["MaskedAcctNum"].ToString());
                row.Cells.Add(_tableTrans.Rows[i]["ExpDate"].ToString());
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(_tableTrans.Rows[i]["Clinic"].ToString());
                }
                row.Cells.Add(_tableTrans.Rows[i]["TransactionID"].ToString());
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }
        private void butOk_Click(object sender, EventArgs e)
        {
            if (!EntriesAreValid())
            {
                return;
            }
            //Saving happens in the parent form
            EhrLabResultCur.ObservationIdentifierID                = textObsID.Text;
            EhrLabResultCur.ObservationIdentifierText              = textObsIDText.Text;
            EhrLabResultCur.ObservationIdentifierCodeSystemName    = textObsIDCodeSystemName.Text;
            EhrLabResultCur.ObservationIdentifierIDAlt             = textObsIDAlt.Text;
            EhrLabResultCur.ObservationIdentifierTextAlt           = textObsIDTextAlt.Text;
            EhrLabResultCur.ObservationIdentifierCodeSystemNameAlt = textObsIDCodeSystemNameAlt.Text;
            EhrLabResultCur.ObservationIdentifierTextOriginal      = textObsIDOrigText.Text;
            EhrLabResultCur.ObservationIdentifierSub               = textObsSub.Text;
            EhrLabResultCur.AbnormalFlags = "";
            for (int i = 0; i < listAbnormalFlags.SelectedIndices.Count; i++)
            {
                if (i > 0)
                {
                    EhrLabResultCur.AbnormalFlags += ",";
                }
                EhrLabResultCur.AbnormalFlags += ((HL70078)listAbnormalFlags.SelectedIndices[i]).ToString();
            }
            //Observation Value
            EhrLabResultCur.ObservationDateTime     = EhrLab.formatDateToHL7(textObsDateTime.Text);
            EhrLabResultCur.AnalysisDateTime        = EhrLab.formatDateToHL7(textAnalysisDateTime.Text);
            EhrLabResultCur.ObservationResultStatus = ((HL70085)comboObsStatus.SelectedIndex - 1);
            EhrLabResultCur.ValueType      = ((HL70125)comboObsValueType.SelectedIndex - 1);
            EhrLabResultCur.referenceRange = textReferenceRange.Text;
            switch (((HL70125)comboObsValueType.SelectedIndex - 1))
            {
            case HL70125.CE:
            case HL70125.CWE:
                break;                        //nothing to do here. yet.

            case HL70125.DT:
            case HL70125.TS:
                EhrLabResultCur.ObservationValueDateTime = EhrLab.formatDateToHL7(textObsValue.Text);
                break;

            case HL70125.NM:
                EhrLabResultCur.ObservationValueNumeric = PIn.Double(textObsValue.Text);
                break;

            case HL70125.FT:
            case HL70125.ST:
            case HL70125.TX:
                EhrLabResultCur.ObservationValueText = textObsValue.Text;                      //should not contain |~^&# characters
                break;

            case HL70125.TM:
                EhrLabResultCur.ObservationValueTime = PIn.Time(textObsValue.Text);
                break;

            case HL70125.SN:
                break;                        //nothing to do here yet.
            }
            //if(((HL70125)comboObsValueType.SelectedIndex-1)==HL70125.DT
            //	|| ((HL70125)comboObsValueType.SelectedIndex-1)==HL70125.TS
            //	|| ((HL70125)comboObsValueType.SelectedIndex-1)==HL70125.TM)
            //{
            //	EhrLabResultCur.ObservationValueDateTime=EhrLab.formatDateToHL7(textObsValue.Text);
            //}
            //else {
            //	EhrLabResultCur.ObservationValueNumeric=PIn.Double(textObsValue.Text);
            //}
            //Coded Element
            EhrLabResultCur.ObservationValueCodedElementID                = textObsElementID.Text;
            EhrLabResultCur.ObservationValueCodedElementText              = textObsElementText.Text;
            EhrLabResultCur.ObservationValueCodedElementCodeSystemName    = textObsElementCodeSystem.Text;
            EhrLabResultCur.ObservationValueCodedElementIDAlt             = textObsElementIDAlt.Text;
            EhrLabResultCur.ObservationValueCodedElementTextAlt           = textObsElementTextAlt.Text;
            EhrLabResultCur.ObservationValueCodedElementCodeSystemNameAlt = textObsElementCodeSystemAlt.Text;
            EhrLabResultCur.ObservationValueCodedElementTextOriginal      = textObsElementOrigText.Text;
            //Structured Numeric
            EhrLabResultCur.ObservationValueComparator        = textStructNumComp.Text;
            EhrLabResultCur.ObservationValueNumber1           = PIn.Double(textStructNumFirst.Text);
            EhrLabResultCur.ObservationValueSeparatorOrSuffix = textStructNumSeparator.Text;
            EhrLabResultCur.ObservationValueNumber2           = PIn.Double(textStructNumSecond.Text);
            //Units
            EhrLabResultCur.UnitsID                = textObsUnitsID.Text;
            EhrLabResultCur.UnitsText              = textObsUnitsText.Text;
            EhrLabResultCur.UnitsCodeSystemName    = textObsUnitsCodeSystem.Text;
            EhrLabResultCur.UnitsIDAlt             = textObsUnitsIDAlt.Text;
            EhrLabResultCur.UnitsTextAlt           = textObsUnitsTextAlt.Text;
            EhrLabResultCur.UnitsCodeSystemNameAlt = textObsUnitsCodeSystemAlt.Text;
            EhrLabResultCur.UnitsTextOriginal      = textObsUnitsTextOrig.Text;
            //Performing Organization
            EhrLabResultCur.PerformingOrganizationName = textPerfOrgName.Text;
            EhrLabResultCur.PerformingOrganizationNameAssigningAuthorityNamespaceId     = textPerfOrgNamespaceID.Text;
            EhrLabResultCur.PerformingOrganizationNameAssigningAuthorityUniversalId     = textPerfOrgUniversalID.Text;
            EhrLabResultCur.PerformingOrganizationNameAssigningAuthorityUniversalIdType = textPerfOrgAssignIdType.Text;
            EhrLabResultCur.PerformingOrganizationIdentifierTypeCode        = ((HL70203)comboPerfOrgIdType.SelectedIndex - 1);
            EhrLabResultCur.PerformingOrganizationIdentifier                = textPerfOrgIdentifier.Text;
            EhrLabResultCur.PerformingOrganizationAddressStreet             = textPerfOrgStreet.Text;
            EhrLabResultCur.PerformingOrganizationAddressOtherDesignation   = textPerfOrgOtherDesignation.Text;
            EhrLabResultCur.PerformingOrganizationAddressCity               = textPerfOrgCity.Text;
            EhrLabResultCur.PerformingOrganizationAddressStateOrProvince    = ((USPSAlphaStateCode)comboPerfOrgState.SelectedIndex - 1);
            EhrLabResultCur.PerformingOrganizationAddressZipOrPostalCode    = textPerfOrgZip.Text;
            EhrLabResultCur.PerformingOrganizationAddressCountryCode        = textPerfOrgCountry.Text;
            EhrLabResultCur.PerformingOrganizationAddressAddressType        = ((HL70190)comboPerfOrgAddressType.SelectedIndex - 1);
            EhrLabResultCur.PerformingOrganizationAddressCountyOrParishCode = textPerfOrgCounty.Text;
            EhrLabResultCur.MedicalDirectorID          = textMedDirIdentifier.Text;
            EhrLabResultCur.MedicalDirectorLName       = textMedDirLastName.Text;
            EhrLabResultCur.MedicalDirectorFName       = textMedDirFirstName.Text;
            EhrLabResultCur.MedicalDirectorMiddleNames = textMedDirMiddleName.Text;
            EhrLabResultCur.MedicalDirectorSuffix      = textMedDirSuffix.Text;
            EhrLabResultCur.MedicalDirectorPrefix      = textMedDirPrefix.Text;
            EhrLabResultCur.MedicalDirectorAssigningAuthorityNamespaceID = textMedDirNamespaceID.Text;
            EhrLabResultCur.MedicalDirectorAssigningAuthorityUniversalID = textMedDirUniversalID.Text;
            EhrLabResultCur.MedicalDirectorAssigningAuthorityIDType      = textMedDirAssignIdType.Text;
            EhrLabResultCur.MedicalDirectorNameTypeCode       = ((HL70200)comboMedDirNameType.SelectedIndex - 1);
            EhrLabResultCur.MedicalDirectorIdentifierTypeCode = ((HL70203)comboMedDirIdType.SelectedIndex - 1);
            //Saving happens in parent form.
            DialogResult = DialogResult.OK;
        }
        protected override void OnOk()
        {
            if (!ArePosAndSizeValid())
            {
                return;
            }
            if (!_hasSelectedFieldName)
            {
                MsgBox.Show(this, "Please select a field name first.");
                return;
            }
            if (_sheetDefCur.SheetType == SheetTypeEnum.ExamSheet)
            {
                if (textReportableName.Text.Contains(";") || textReportableName.Text.Contains(":"))
                {
                    MsgBox.Show(this, "Reportable name for Exam Sheet fields may not contain a ':' or a ';'.");
                    return;
                }
                if (comboRadioGroupNameMisc.Text.Contains(";") || comboRadioGroupNameMisc.Text.Contains(":"))
                {
                    MsgBox.Show(this, "Radio button group name for Exam Sheet fields may not contain a ':' or a ';'.");
                    return;
                }
            }
            string fieldName        = _selectedFieldName;
            string radioButtonValue = "";
            string radioItemValue   = "";

            #region Medical History Sheet
            if (_isMedHistSheet && fieldName != "misc")
            {
                if (listMedical.Visible)
                {
                    if (!_hasSelectedMedicalItem)
                    {
                        switch (fieldName)
                        {
                        case "allergy":
                            MsgBox.Show(this, "Please select an allergy first.");
                            return;

                        case "problem":
                            MsgBox.Show(this, "Please select a problem first.");
                            return;
                        }
                    }
                    fieldName += ":" + _selectedMedicalItemName;
                }
                if (radioNo.Checked || fieldName.StartsWith("checkMed"))
                {
                    radioButtonValue = "N";
                    radioItemValue   = "No";                 //Default
                    if (!textMobileCheckOverride.Text.IsNullOrEmpty())
                    {
                        radioItemValue = textMobileCheckOverride.Text;
                    }
                }
                else
                {
                    radioButtonValue = "Y";
                    radioItemValue   = "Yes";                 //Default
                    if (!textMobileCheckOverride.Text.IsNullOrEmpty())
                    {
                        radioItemValue = textMobileCheckOverride.Text;
                    }
                }
            }
            #endregion
            if (groupRadio.Visible && listRadio.SelectedIndex < 0)
            {
                MsgBox.Show(this, "Please select a Radio Button Value first.");
                return;
            }
            SheetFieldDefCur.FieldName      = fieldName;
            SheetFieldDefCur.ReportableName = textReportableName.Text;          //always safe even if not a misc field or if textReportableName is blank.
            //We will set these below where applicable.
            SheetFieldDefCur.RadioButtonGroup         = "";
            SheetFieldDefCur.UiLabelMobile            = "";
            SheetFieldDefCur.UiLabelMobileRadioButton = "";
            SheetFieldDefCur.RadioButtonValue         = radioButtonValue;
            Action <string> updateGroupCaptionForFieldName = new Action <string>((caption) => {
                SheetFieldDefCur.UiLabelMobile = caption;
                _sheetDefCur.SheetFieldDefs
                .Where(x =>
                       x.FieldType == SheetFieldType.CheckBox &&
                       !string.IsNullOrEmpty(x.FieldName) &&
                       x.FieldName == SheetFieldDefCur.FieldName)
                .ForEach(x => {
                    x.UiLabelMobile = caption;
                });
            });
            if (groupRadio.Visible)
            {
                //All items with this group name get this UiLabelMobile.
                updateGroupCaptionForFieldName(textUiLabelMobile.Text);
                if (listRadio.SelectedIndex >= 0)
                {
                    SheetFieldDefCur.RadioButtonValue = radioButtonValues[listRadio.SelectedIndex];
                }
            }
            else if (groupRadioMisc.Visible)
            {
                SheetFieldDefCur.RadioButtonGroup         = comboRadioGroupNameMisc.Text;
                SheetFieldDefCur.UiLabelMobile            = textUiLabelMobileMisc.Text;
                SheetFieldDefCur.UiLabelMobileRadioButton = textUiLabelMobileRadioButtonMisc.Text;
                //All items with this group name get this UiLabelMobile.
                _sheetDefCur.SheetFieldDefs
                .Where(x =>
                       x.FieldType == SheetFieldType.CheckBox &&
                       !string.IsNullOrEmpty(x.RadioButtonGroup) &&
                       x.RadioButtonGroup == SheetFieldDefCur.RadioButtonGroup)
                .ForEach(x => x.UiLabelMobile = SheetFieldDefCur.UiLabelMobile);
            }
            else if (_isMedHistSheet)
            {
                //All items with this group name get this UiLabelMobile.
                string medicalName = _selectedMedicalItemName;
                if (textMobileMedicalNameOverride.Visible && !textMobileMedicalNameOverride.Text.IsNullOrEmpty())
                {
                    medicalName = textMobileMedicalNameOverride.Text;
                }
                updateGroupCaptionForFieldName(medicalName);
                SheetFieldDefCur.UiLabelMobileRadioButton = radioItemValue;
            }
            else if (labelUiLabelMobileCheckBoxNonMisc.Visible)
            {
                //All items with this group name get this UiLabelMobile.
                updateGroupCaptionForFieldName(textUiLabelMobileCheckBoxNonMisc.Text);
                SheetFieldDefCur.UiLabelMobileRadioButton = string.IsNullOrEmpty(radioItemValue) ? textUiLabelMobileCheckBoxNonMisc.Text : radioItemValue;
            }
            SheetFieldDefCur.IsRequired = checkRequired.Checked;
            SheetFieldDefCur.TabOrder   = PIn.Int(textTabOrder.Text);
            //don't save to database here.
            SheetFieldDefCur.IsNew = false;
            DialogResult           = DialogResult.OK;
        }
Exemple #22
0
        private static void pd_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Graphics g = e.Graphics;

            g.SmoothingMode = SmoothingMode.HighQuality;
            Sheet sheet = SheetList[sheetsPrinted];

            SheetUtil.CalculateHeights(sheet, g);           //this is here because of easy access to g.
            Font      font;
            FontStyle fontstyle;

            //first, draw images------------------------------------------------------------------------------------
            foreach (SheetField field in sheet.SheetFields)
            {
                if (field.FieldType != SheetFieldType.Image)
                {
                    continue;
                }
                string filePathAndName = ODFileUtils.CombinePaths(SheetUtil.GetImagePath(), field.FieldName);
                Image  img             = null; //js consider switching this from an image to a bitmap
                if (field.FieldName == "Patient Info.gif")
                {
                    img = Properties.Resources.Patient_Info;
                }
                else if (File.Exists(filePathAndName))
                {
                    img = Image.FromFile(filePathAndName);
                }
                else
                {
                    continue;
                }
                g.DrawImage(img, field.XPos, field.YPos, field.Width, field.Height);
                img.Dispose();
                img = null;
            }
            //then, drawings--------------------------------------------------------------------------------------------
            Pen pen = new Pen(Brushes.Black, 2f);

            string[]     pointStr;
            List <Point> points;
            Point        point;

            string[] xy;
            foreach (SheetField field in sheet.SheetFields)
            {
                if (field.FieldType != SheetFieldType.Drawing)
                {
                    continue;
                }
                pointStr = field.FieldValue.Split(';');
                points   = new List <Point>();
                for (int p = 0; p < pointStr.Length; p++)
                {
                    xy = pointStr[p].Split(',');
                    if (xy.Length == 2)
                    {
                        point = new Point(PIn.Int(xy[0]), PIn.Int(xy[1]));
                        points.Add(point);
                    }
                }
                for (int i = 1; i < points.Count; i++)
                {
                    g.DrawLine(pen, points[i - 1].X, points[i - 1].Y, points[i].X, points[i].Y);
                }
            }
            //then, rectangles and lines----------------------------------------------------------------------------------
            Pen pen2 = new Pen(Brushes.Black, 1f);

            foreach (SheetField field in sheet.SheetFields)
            {
                if (field.FieldType == SheetFieldType.Rectangle)
                {
                    g.DrawRectangle(pen2, field.XPos, field.YPos, field.Width, field.Height);
                }
                if (field.FieldType == SheetFieldType.Line)
                {
                    g.DrawLine(pen2, field.XPos, field.YPos,
                               field.XPos + field.Width,
                               field.YPos + field.Height);
                }
            }
            //then, draw text-----------------------------------------------------------------------------------------------
            Bitmap   doubleBuffer = new Bitmap(sheet.Width, sheet.Height);
            Graphics gfx          = Graphics.FromImage(doubleBuffer);

            foreach (SheetField field in sheet.SheetFields)
            {
                if (field.FieldType != SheetFieldType.InputField &&
                    field.FieldType != SheetFieldType.OutputText &&
                    field.FieldType != SheetFieldType.StaticText)
                {
                    continue;
                }
                fontstyle = FontStyle.Regular;
                if (field.FontIsBold)
                {
                    fontstyle = FontStyle.Bold;
                }
                font = new Font(field.FontName, field.FontSize, fontstyle);
                Plugins.HookAddCode(null, "SheetPrinting.pd_PrintPage_drawFieldLoop", field);
                GraphicsHelper.DrawString(g, gfx, field.FieldValue, font, Brushes.Black, field.Bounds);
                //g.DrawString(field.FieldValue,font,Brushes.Black,field.BoundsF);
            }
            gfx.Dispose();
            //then, checkboxes----------------------------------------------------------------------------------
            Pen pen3 = new Pen(Brushes.Black, 1.6f);

            foreach (SheetField field in sheet.SheetFields)
            {
                if (field.FieldType != SheetFieldType.CheckBox)
                {
                    continue;
                }
                if (field.FieldValue == "X")
                {
                    g.DrawLine(pen3, field.XPos, field.YPos, field.XPos + field.Width, field.YPos + field.Height);
                    g.DrawLine(pen3, field.XPos + field.Width, field.YPos, field.XPos, field.YPos + field.Height);
                }
            }
            //then signature boxes----------------------------------------------------------------------
            foreach (SheetField field in sheet.SheetFields)
            {
                if (field.FieldType != SheetFieldType.SigBox)
                {
                    continue;
                }
                SignatureBoxWrapper wrapper = new SignatureBoxWrapper();
                wrapper.Width  = field.Width;
                wrapper.Height = field.Height;
                if (field.FieldValue.Length > 0)              //a signature is present
                {
                    bool sigIsTopaz = false;
                    if (field.FieldValue[0] == '1')
                    {
                        sigIsTopaz = true;
                    }
                    string signature = "";
                    if (field.FieldValue.Length > 1)
                    {
                        signature = field.FieldValue.Substring(1);
                    }
                    string keyData = Sheets.GetSignatureKey(sheet);
                    wrapper.FillSignature(sigIsTopaz, keyData, signature);
                }
                Bitmap sigBitmap = wrapper.GetSigImage();
                g.DrawImage(sigBitmap, field.XPos, field.YPos, field.Width - 2, field.Height - 2);
            }
            g.Dispose();
            //no logic yet for multiple pages on one sheet.
            sheetsPrinted++;
            //heightsCalculated=false;
            if (sheetsPrinted < SheetList.Count)
            {
                e.HasMorePages = true;
            }
            else
            {
                e.HasMorePages = false;
                sheetsPrinted  = 0;
            }
        }
Exemple #23
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDaysOld.errorProvider1.GetError(textDaysOld) != "")
            {
                MessageBox.Show(Lan.g("All", "Please correct data entry errors first."));
                return;
            }
            int daysOld = PIn.PInt(textDaysOld.Text);

            //FormQuery2.ResetGrid();//this is a method in FormQuery2;
            Queries.CurReport = new ReportOld();
            DateTime startQDate = DateTime.Today.AddDays(-daysOld);

            Queries.CurReport.Query = "SELECT carrier.CarrierName,claim.ClaimNum"
                                      + ",claim.ClaimType,claim.DateService,"
                                      + "CONCAT(CONCAT(CONCAT(CONCAT(patient.LName,', '),patient.FName),' '),patient.MiddleI), claim.DateSent"
                                      + ",claim.ClaimFee,carrier.Phone "
                                      + "FROM claim,insplan,patient,carrier "
                                      + "WHERE claim.PlanNum = insplan.PlanNum "
                                      + "AND claim.PatNum = patient.PatNum "
                                      + "AND carrier.CarrierNum = insplan.CarrierNum "
                                      + "AND claim.ClaimStatus='S' && claim.DateSent < " + POut.PDate(startQDate) + " "
                                      + "ORDER BY carrier.Phone,insplan.PlanNum";
            FormQuery2          = new FormQuery();
            FormQuery2.IsReport = true;

            Queries.SubmitTemp();                                         //create TableTemp
            Queries.TableQ = new DataTable(null);                         //new table no name
            for (int i = 0; i < 6; i++)                                   //add columns
            {
                Queries.TableQ.Columns.Add(new System.Data.DataColumn()); //blank columns
            }
            Queries.CurReport.ColTotal = new double[Queries.TableQ.Columns.Count];
            for (int i = 0; i < Queries.TableTemp.Rows.Count; i++)    //loop through data rows
            {
                DataRow row = Queries.TableQ.NewRow();                //create new row called 'row' based on structure of TableQ
                //start filling 'row'. First column is carrier:
                row[0] = Queries.TableTemp.Rows[i][0];
                row[1] = Queries.TableTemp.Rows[i][7];
                if (PIn.PString(Queries.TableTemp.Rows[i][2].ToString()) == "P")
                {
                    row[2] = "Primary";
                }
                if (PIn.PString(Queries.TableTemp.Rows[i][2].ToString()) == "S")
                {
                    row[2] = "Secondary";
                }
                if (PIn.PString(Queries.TableTemp.Rows[i][2].ToString()) == "PreAuth")
                {
                    row[2] = "PreAuth";
                }
                if (PIn.PString(Queries.TableTemp.Rows[i][2].ToString()) == "Other")
                {
                    row[2] = "Other";
                }
                row[3] = Queries.TableTemp.Rows[i][4];
                row[4] = (PIn.PDate(Queries.TableTemp.Rows[i][3].ToString())).ToString("d");
                row[5] = PIn.PDouble(Queries.TableTemp.Rows[i][6].ToString()).ToString("F");
                //TimeSpan d = DateTime.Today.Subtract((PIn.PDate(Queries.TableTemp.Rows[i][5].ToString())));
                //if(d.Days>5000)
                //	row[4]="";
                //else
                //	row[4]=d.Days.ToString();
                Queries.CurReport.ColTotal[5] += PIn.PDouble(Queries.TableTemp.Rows[i][6].ToString());
                Queries.TableQ.Rows.Add(row);
            }
            Queries.CurReport.ColWidth   = new int[Queries.TableQ.Columns.Count];
            Queries.CurReport.ColPos     = new int[Queries.TableQ.Columns.Count + 1];
            Queries.CurReport.ColPos[0]  = 0;
            Queries.CurReport.ColCaption = new string[Queries.TableQ.Columns.Count];
            Queries.CurReport.ColAlign   = new HorizontalAlignment[Queries.TableQ.Columns.Count];
            FormQuery2.ResetGrid();            //this is a method in FormQuery2;
            Queries.CurReport.Title         = "OUTSTANDING INSURANCE CLAIMS";
            Queries.CurReport.SubTitle      = new string[3];
            Queries.CurReport.SubTitle[0]   = ((Pref)PrefB.HList["PracticeTitle"]).ValueString;
            Queries.CurReport.SubTitle[1]   = "Days Outstanding: " + daysOld;
            Queries.CurReport.ColPos[0]     = 20;
            Queries.CurReport.ColPos[1]     = 210;
            Queries.CurReport.ColPos[2]     = 330;
            Queries.CurReport.ColPos[3]     = 430;
            Queries.CurReport.ColPos[4]     = 600;
            Queries.CurReport.ColPos[5]     = 690;
            Queries.CurReport.ColPos[6]     = 770;
            Queries.CurReport.ColCaption[0] = Lan.g(this, "Carrier");
            Queries.CurReport.ColCaption[1] = Lan.g(this, "Phone");
            Queries.CurReport.ColCaption[2] = Lan.g(this, "Type");
            Queries.CurReport.ColCaption[3] = Lan.g(this, "Patient Name");
            Queries.CurReport.ColCaption[4] = Lan.g(this, "Date of Service");
            Queries.CurReport.ColCaption[5] = Lan.g(this, "Amount");
            Queries.CurReport.ColAlign[5]   = HorizontalAlignment.Right;
            Queries.CurReport.Summary       = new string[3];
            FormQuery2.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemple #24
0
        public static void CreatePdfPage(Sheet sheet, PdfPage page)
        {
            page.Width  = p(sheet.Width);         //XUnit.FromInch((double)sheet.Width/100);  //new XUnit((double)sheet.Width/100,XGraphicsUnit.Inch);
            page.Height = p(sheet.Height);        //new XUnit((double)sheet.Height/100,XGraphicsUnit.Inch);
            if (sheet.IsLandscape)
            {
                page.Orientation = PageOrientation.Landscape;
            }
            XGraphics g = XGraphics.FromPdfPage(page);

            g.SmoothingMode = XSmoothingMode.HighQuality;
            //g.PageUnit=XGraphicsUnit. //wish they had pixel
            //XTextFormatter tf = new XTextFormatter(g);//needed for text wrap
            //tf.Alignment=XParagraphAlignment.Left;
            //pd.DefaultPageSettings.Landscape=
            //already done?:SheetUtil.CalculateHeights(sheet,g);//this is here because of easy access to g.
            XFont      xfont;
            XFontStyle xfontstyle;

            //first, draw images--------------------------------------------------------------------------------------
            foreach (SheetField field in sheet.SheetFields)
            {
                if (field.FieldType != SheetFieldType.Image)
                {
                    continue;
                }
                string filePathAndName = ODFileUtils.CombinePaths(SheetUtil.GetImagePath(), field.FieldName);
                Bitmap bitmapOriginal  = null;
                if (field.FieldName == "Patient Info.gif")
                {
                    bitmapOriginal = Properties.Resources.Patient_Info;
                }
                else if (File.Exists(filePathAndName))
                {
                    bitmapOriginal = new Bitmap(filePathAndName);
                }
                else
                {
                    continue;
                }
                Bitmap bitmapResampled = (Bitmap)bitmapOriginal.Clone();
                if (bitmapOriginal.HorizontalResolution != 96 || bitmapOriginal.VerticalResolution != 96)            //to avoid slowdown for other pdfs
                //The scaling on the XGraphics.DrawImage() function causes unreadable output unless the image is in 96 DPI native format.
                //We use GDI here first to convert the image to the correct size and DPI, then pass the second image to XGraphics.DrawImage().
                {
                    bitmapResampled.Dispose();
                    bitmapResampled = null;
                    bitmapResampled = new Bitmap(field.Width, field.Height);
                    Graphics gr = Graphics.FromImage(bitmapResampled);
                    gr.DrawImage(bitmapOriginal, 0, 0, field.Width, field.Height);
                    gr.Dispose();
                }
                g.DrawImage(bitmapResampled, p(field.XPos), p(field.YPos), p(field.Width), p(field.Height));
                bitmapResampled.Dispose();
                bitmapResampled = null;
                bitmapOriginal.Dispose();
                bitmapOriginal = null;
            }
            //then, drawings--------------------------------------------------------------------------------------------
            XPen pen = new XPen(XColors.Black, p(2));

            string[]     pointStr;
            List <Point> points;
            Point        point;

            string[] xy;
            foreach (SheetField field in sheet.SheetFields)
            {
                if (field.FieldType != SheetFieldType.Drawing)
                {
                    continue;
                }
                pointStr = field.FieldValue.Split(';');
                points   = new List <Point>();
                for (int j = 0; j < pointStr.Length; j++)
                {
                    xy = pointStr[j].Split(',');
                    if (xy.Length == 2)
                    {
                        point = new Point(PIn.Int(xy[0]), PIn.Int(xy[1]));
                        points.Add(point);
                    }
                }
                for (int i = 1; i < points.Count; i++)
                {
                    g.DrawLine(pen, p(points[i - 1].X), p(points[i - 1].Y), p(points[i].X), p(points[i].Y));
                }
            }
            //then, rectangles and lines----------------------------------------------------------------------------------
            XPen pen2 = new XPen(XColors.Black, p(1));

            foreach (SheetField field in sheet.SheetFields)
            {
                if (field.FieldType == SheetFieldType.Rectangle)
                {
                    g.DrawRectangle(pen2, p(field.XPos), p(field.YPos), p(field.Width), p(field.Height));
                }
                if (field.FieldType == SheetFieldType.Line)
                {
                    g.DrawLine(pen2, p(field.XPos), p(field.YPos),
                               p(field.XPos + field.Width),
                               p(field.YPos + field.Height));
                }
            }
            //then, draw text--------------------------------------------------------------------------------------------
            Bitmap   doubleBuffer = new Bitmap(sheet.Width, sheet.Height);
            Graphics gfx          = Graphics.FromImage(doubleBuffer);

            foreach (SheetField field in sheet.SheetFields)
            {
                if (field.FieldType != SheetFieldType.InputField &&
                    field.FieldType != SheetFieldType.OutputText &&
                    field.FieldType != SheetFieldType.StaticText)
                {
                    continue;
                }
                xfontstyle = XFontStyle.Regular;
                if (field.FontIsBold)
                {
                    xfontstyle = XFontStyle.Bold;
                }
                xfont = new XFont(field.FontName, field.FontSize, xfontstyle);
                //xfont=new XFont(field.FontName,field.FontSize,xfontstyle);
                //Rectangle rect=new Rectangle((int)p(field.XPos),(int)p(field.YPos),(int)p(field.Width),(int)p(field.Height));
                XRect xrect = new XRect(p(field.XPos), p(field.YPos), p(field.Width), p(field.Height));
                //XStringFormat format=new XStringFormat();
                //tf.DrawString(field.FieldValue,font,XBrushes.Black,xrect,XStringFormats.TopLeft);
                GraphicsHelper.DrawStringX(g, gfx, 1d / p(1), field.FieldValue, xfont, XBrushes.Black, xrect);
            }
            gfx.Dispose();
            //then, checkboxes----------------------------------------------------------------------------------
            XPen pen3 = new XPen(XColors.Black, p(1.6f));

            foreach (SheetField field in sheet.SheetFields)
            {
                if (field.FieldType != SheetFieldType.CheckBox)
                {
                    continue;
                }
                if (field.FieldValue == "X")
                {
                    g.DrawLine(pen3, p(field.XPos), p(field.YPos), p(field.XPos + field.Width), p(field.YPos + field.Height));
                    g.DrawLine(pen3, p(field.XPos + field.Width), p(field.YPos), p(field.XPos), p(field.YPos + field.Height));
                }
            }
            //then signature boxes----------------------------------------------------------------------
            foreach (SheetField field in sheet.SheetFields)
            {
                if (field.FieldType != SheetFieldType.SigBox)
                {
                    continue;
                }
                SignatureBoxWrapper wrapper = new SignatureBoxWrapper();
                wrapper.Width  = field.Width;
                wrapper.Height = field.Height;
                if (field.FieldValue.Length > 0)              //a signature is present
                {
                    bool sigIsTopaz = false;
                    if (field.FieldValue[0] == '1')
                    {
                        sigIsTopaz = true;
                    }
                    string signature = "";
                    if (field.FieldValue.Length > 1)
                    {
                        signature = field.FieldValue.Substring(1);
                    }
                    string keyData = Sheets.GetSignatureKey(sheet);
                    wrapper.FillSignature(sigIsTopaz, keyData, signature);
                }
                XImage sigBitmap = XImage.FromGdiPlusImage(wrapper.GetSigImage());
                g.DrawImage(sigBitmap, p(field.XPos), p(field.YPos), p(field.Width - 2), p(field.Height - 2));
            }
        }
Exemple #25
0
        private void FillGrid()
        {
            if (checkShowImplicit.Checked)
            {
                CreatePayPlanEntries(true);
            }
            else
            {
                CreatePayPlanEntries();
            }
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Date"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Stat"), 30);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Code"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Fee"), 55, HorizontalAlignment.Right);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Rem Before"), 70, HorizontalAlignment.Right);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Credit Date"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Amount"), 55, HorizontalAlignment.Right);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Rem After"), 60, HorizontalAlignment.Right);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TablePaymentPlanProcsAndCreds", "Note"), 0);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;
            double    totalAttached = 0;

            foreach (PayPlanEntry entryCur in _listPayPlanEntries)              //for all account charges
            {
                if (checkHideUnattached.Checked && !ListPayPlanCreditsCur.Exists(x => x.ProcNum == entryCur.ProcNumOrd))
                {
                    continue;
                }
                row = new ODGridRow();
                //we color the relevant cells to make the table easier to read.
                //the colors have been looked-at and approved by colourblind Josh.
                //In the future, we will probably make these customizable definitions.
                ODGridCell cell = new ODGridCell(entryCur.DateStr);
                //for procedure rows, cell color should be LightYellow for all relevant fields.
                cell.CellColor = entryCur.IsChargeOrd ? Color.White : Color.LightYellow;
                row.Cells.Add(cell);
                cell           = new ODGridCell(entryCur.StatStr);
                cell.CellColor = entryCur.IsChargeOrd ? Color.White : Color.LightYellow;
                row.Cells.Add(cell);
                cell           = new ODGridCell(entryCur.ProcStr);
                cell.CellColor = entryCur.IsChargeOrd ? Color.White : Color.LightYellow;
                row.Cells.Add(cell);
                cell           = new ODGridCell(entryCur.FeeStr);
                cell.CellColor = entryCur.IsChargeOrd ? Color.White : Color.LightYellow;
                row.Cells.Add(cell);
                cell           = new ODGridCell(entryCur.RemBefStr);
                cell.CellColor = entryCur.IsChargeOrd ? Color.White : Color.LightYellow;
                row.Cells.Add(cell);
                cell = new ODGridCell(entryCur.CredDateStr);
                //for charge rows, cell color should be LightCyan for all relevant fields.
                cell.CellColor = entryCur.IsChargeOrd ? Color.LightCyan : Color.White;
                row.Cells.Add(cell);
                cell           = new ODGridCell(entryCur.AmtStr);
                cell.CellColor = entryCur.IsChargeOrd ? Color.LightCyan : Color.White;
                row.Cells.Add(cell);
                totalAttached += PIn.Double(entryCur.AmtStr);
                cell           = new ODGridCell(entryCur.RemAftStr);
                cell.CellColor = entryCur.IsChargeOrd ? Color.LightCyan : Color.White;
                row.Cells.Add(cell);
                cell           = new ODGridCell(entryCur.NoteStr);
                cell.CellColor = entryCur.IsChargeOrd ? Color.LightCyan : Color.White;
                row.Cells.Add(cell);
                row.Tag = entryCur;
                if (!entryCur.IsChargeOrd)
                {
                    row.ColorLborder = Color.Black;
                }
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            textTotal.Text = totalAttached.ToString("f");
        }
Exemple #26
0
        private void FormOrthoSetup_Load(object sender, EventArgs e)
        {
            checkPatClone.Checked = PrefC.GetBool(PrefName.ShowFeaturePatientClone);
            checkApptModuleShowOrthoChartItem.Checked = PrefC.GetBool(PrefName.ApptModuleShowOrthoChartItem);
            checkOrthoEnabled.Checked = PrefC.GetBool(PrefName.OrthoEnabled);
            checkOrthoFinancialInfoInChart.Checked  = PrefC.GetBool(PrefName.OrthoCaseInfoInOrthoChart);
            checkOrthoClaimMarkAsOrtho.Checked      = PrefC.GetBool(PrefName.OrthoClaimMarkAsOrtho);
            checkOrthoClaimUseDatePlacement.Checked = PrefC.GetBool(PrefName.OrthoClaimUseDatePlacement);
            textOrthoMonthsTreat.Text          = PrefC.GetByte(PrefName.OrthoDefaultMonthsTreat).ToString();
            _orthoAutoProcCodeNum              = PrefC.GetLong(PrefName.OrthoAutoProcCodeNum);
            textOrthoAutoProc.Text             = ProcedureCodes.GetStringProcCode(_orthoAutoProcCodeNum);
            checkConsolidateInsPayment.Checked = PrefC.GetBool(PrefName.OrthoInsPayConsolidated);
            string strListOrthoNums = PrefC.GetString(PrefName.OrthoPlacementProcsList);

            if (strListOrthoNums != "")
            {
                _listOrthoPlacementCodeNums.AddRange(strListOrthoNums.Split(new char[] { ',' }).ToList().Select(x => PIn.Long(x)));
            }
            RefreshListBoxProcs();
        }
Exemple #27
0
        private void butAddOrUpdate_Click(object sender, EventArgs e)
        {
            List <PayPlanEntry> listSelectedEntries = new List <PayPlanEntry>();

            for (int i = 0; i < gridMain.SelectedIndices.Count(); i++)          //add all of the currently selected entries to this list.
            {
                listSelectedEntries.Add((PayPlanEntry)(gridMain.Rows[gridMain.SelectedIndices[i]].Tag));
            }
            if (listSelectedEntries.Count <= 1)            //validation (doesn't matter if multiple are selected)
            {
                if (String.IsNullOrEmpty(textAmt.Text) || textAmt.errorProvider1.GetError(textAmt) != "" || PIn.Double(textAmt.Text) == 0)
                {
                    MsgBox.Show(this, "Please enter a valid amount.");
                    return;
                }
                if (textDate.Text != "" && textDate.errorProvider1.GetError(textDate) != "")
                {
                    MsgBox.Show(this, "Please enter a valid date.");
                    return;
                }
            }
            if (textDate.Text == "")
            {
                textDate.Text = DateTime.Today.ToShortDateString();
            }
            if (Security.IsGlobalDateLock(Permissions.PayPlanEdit, PIn.Date(textDate.Text)))
            {
                return;
            }
            if (listSelectedEntries.Count == 0)            //if they have none selected
            //add an unattached charge.
            {
                PayPlanCharge addCharge = new PayPlanCharge()
                {
                    ChargeDate = PIn.Date(textDate.Text),
                    ChargeType = PayPlanChargeType.Credit,
                    Guarantor  = _patCur.PatNum,                 //credits should always appear on the patient of the payment plan.
                    Note       = PIn.String(textNote.Text),
                    PatNum     = _patCur.PatNum,
                    PayPlanNum = _payPlanCur.PayPlanNum,
                    Principal  = PIn.Double(textAmt.Text),
                    ProcNum    = 0,
                    //provider/clinic will be set when the amortization schedule is saved. FormPayPlan.SaveData()
                    //ClinicNum=0,
                    //ProvNum=0,
                };
                ListPayPlanCreditsCur.Add(addCharge);
            }
            else if (listSelectedEntries.Count == 1)            //if they have one selected
            {
                PayPlanEntry selectedEntry = listSelectedEntries[0];
                if (selectedEntry.IsChargeOrd)                  //if it's a charge
                //update the charge selected. get info from text boxes.
                //DO NOT use PayPlanChargeNum. They are not pre-inserted so they will all be 0 if new.
                {
                    PayPlanCharge selectedCharge = ((PayPlanEntry)(gridMain.Rows[gridMain.SelectedIndices[0]].Tag)).Charge;
                    selectedCharge.Principal = PIn.Double(textAmt.Text);
                    selectedCharge.Note      = PIn.String(textNote.Text);
                    if (selectedEntry.ProcStatOrd == ProcStat.TP && selectedEntry.ProcNumOrd != 0)                  //if it's treatment planned, save the date as maxvalue so it will not show up in the ledger.
                    //if it doesn't have a procnum, then we are editing an unattached row.
                    {
                        selectedCharge.ChargeDate = DateTime.MaxValue;
                    }
                    else
                    {
                        selectedCharge.ChargeDate = PIn.Date(textDate.Text);
                    }
                }
                else                   //if it's a procedure
                                       //add a charge for the selected procedure. get info from text boxes.
                {
                    PayPlanCharge addCharge = new PayPlanCharge();
                    if (selectedEntry.ProcStatOrd == ProcStat.TP && selectedEntry.ProcNumOrd != 0)                 //If tp, maxvalue.
                    //if procnum == 0, it's unattached.
                    {
                        addCharge.ChargeDate = DateTime.MaxValue;
                    }
                    else
                    {
                        addCharge.ChargeDate = PIn.Date(textDate.Text);
                    }
                    addCharge.ChargeType = PayPlanChargeType.Credit;
                    addCharge.Guarantor  = _patCur.PatNum;                 //credits should always appear on the patient of the payment plan.
                    addCharge.Note       = PIn.String(textNote.Text);
                    addCharge.PatNum     = _patCur.PatNum;
                    addCharge.PayPlanNum = _payPlanCur.PayPlanNum;
                    addCharge.Principal  = PIn.Double(textAmt.Text);
                    addCharge.ProcNum    = selectedEntry.ProcNumOrd;
                    //provider/clinic will be set when the amortization schedule is saved. FormPayPlan.SaveData()
                    //ClinicNum=0,
                    //ProvNum=0,
                    ListPayPlanCreditsCur.Add(addCharge);
                }
            }
            else if (listSelectedEntries.Count > 1)            //if they have more than one entry selected
            //remove everythig that doesn't have a procnum from the list
            {
                List <PayPlanEntry> listSelectedProcs = listSelectedEntries.Where(x => !x.IsChargeOrd).Where(x => x.Proc != null).ToList();
                if (listSelectedEntries.Count == 0)                //if the list is then empty, there's nothing to do.
                {
                    MsgBox.Show(this, "You must have at least one procedure selected.");
                    return;
                }
                if (!MsgBox.Show(this, MsgBoxButtons.OKCancel,
                                 "Add a payment plan credit for each of the selected procedure's remaining amount?  Selected credits will be ignored."))
                {
                    return;
                }
                //add a charge for every selected procedure for the amount remaining.
                //don't allow adding $0.00 credits.
                foreach (PayPlanEntry entryProcCur in listSelectedProcs)
                {
                    List <PayPlanEntry> listEntriesForProc = _listPayPlanEntries
                                                             .Where(x => x.ProcNumOrd == entryProcCur.ProcNumOrd)
                                                             .Where(x => x.IsChargeOrd == true).ToList();
                    PayPlanCharge addCharge = new PayPlanCharge();
                    if (entryProcCur.ProcStatOrd == ProcStat.TP)                   //If tp, maxvalue.
                    {
                        addCharge.ChargeDate = DateTime.MaxValue;
                    }
                    else
                    {
                        addCharge.ChargeDate = DateTimeOD.Today;
                    }
                    addCharge.ChargeType = PayPlanChargeType.Credit;
                    addCharge.Guarantor  = _patCur.PatNum;                 //credits should always appear on the patient of the payment plan.
                    addCharge.Note       = ProcedureCodes.GetStringProcCode(entryProcCur.Proc.CodeNum) + ": " + Procedures.GetDescription(entryProcCur.Proc);
                    addCharge.PatNum     = _patCur.PatNum;
                    addCharge.PayPlanNum = _payPlanCur.PayPlanNum;
                    addCharge.Principal  = PIn.Double(entryProcCur.RemBefStr);
                    if (listEntriesForProc.Count != 0)
                    {
                        addCharge.Principal = listEntriesForProc.Min(x => PIn.Double(x.RemAftStr));
                    }
                    addCharge.ProcNum = entryProcCur.ProcNumOrd;
                    //provider/clinic will be set when the amortization schedule is saved. FormPayPlan.SaveData()
                    //ClinicNum=0,
                    //ProvNum=0,
                    if (addCharge.Principal > 0)
                    {
                        ListPayPlanCreditsCur.Add(addCharge);
                    }
                }
            }
            textAmt.Text  = "";
            textDate.Text = "";
            textNote.Text = "";
            FillGrid();
            SetTextBoxes();
        }
        private void FillGridWebSchedNewPatApptTimeSlotsThreaded()
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke((Action) delegate() {
                    FillGridWebSchedNewPatApptTimeSlotsThreaded();
                });
                return;
            }
            //Clear the current grid rows before starting the thread below. This allows that thread to exit at any time without leaving old rows in the grid.
            gridWebSchedNewPatApptTimeSlots.BeginUpdate();
            gridWebSchedNewPatApptTimeSlots.Rows.Clear();
            gridWebSchedNewPatApptTimeSlots.EndUpdate();
            //Validate time slot settings.
            if (textWebSchedNewPatApptsDateStart.errorProvider1.GetError(textWebSchedNewPatApptsDateStart) != "")
            {
                //Don't bother warning the user.  It will just be annoying.  The red indicator should be sufficient.
                return;
            }
            if (comboWSNPClinics.SelectedIndex < 0)
            {
                return;                //Nothing to do.
            }
            WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutEService signup = ((ODBoxItem <WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutEService>)comboWSNPClinics.SelectedItem).Tag;
            //Protect against re-entry
            if (_threadFillGridWebSchedNewPatApptTimeSlots != null)
            {
                //A thread is already refreshing the time slots grid so we simply need to queue up another refresh once the one thread has finished.
                _isWebSchedNewPatApptTimeSlotsOutdated = true;
                return;
            }
            _isWebSchedNewPatApptTimeSlotsOutdated = false;
            _indexLastNewPatURL = comboWSNPClinics.SelectedIndex;
            DateTime dateStart = PIn.DateT(textWebSchedNewPatApptsDateStart.Text);
            DateTime dateEnd   = dateStart.AddDays(30);

            if (!signup.IsEnabled)
            {
                return;                //Do nothing, this clinic is excluded from New Pat Appts.
            }
            //Only get time slots for headquarters or clinics that are NOT excluded (aka included).
            var args = new {
                ClinicNum   = signup.ClinicNum,
                DateStart   = dateStart,
                DateEnd     = dateStart.AddDays(30),
                DefApptType = comboWSNPADefApptType.SelectedTag <Def>(),
            };

            _threadFillGridWebSchedNewPatApptTimeSlots = new ODThread(new ODThread.WorkerDelegate((th) => {
                //The user might not have Web Sched ops set up correctly.  Don't warn them here because it is just annoying.  They'll figure it out.
                ODException.SwallowAnyException(() => {
                    //Get the next 30 days of open time schedules with the current settings
                    List <TimeSlot> listTimeSlots = TimeSlots.GetAvailableNewPatApptTimeSlots(args.DateStart, args.DateEnd, args.ClinicNum
                                                                                              , args.DefApptType.DefNum);
                    FillGridWebSchedNewPatApptTimeSlots(listTimeSlots);
                });
            }))
            {
                Name = "ThreadWebSchedNewPatApptTimeSlots"
            };
            _threadFillGridWebSchedNewPatApptTimeSlots.AddExitHandler(new ODThread.WorkerDelegate((th) => {
                _threadFillGridWebSchedNewPatApptTimeSlots = null;
                //If something else wanted to refresh the grid while we were busy filling it then we need to refresh again.  A filter could have changed.
                if (_isWebSchedNewPatApptTimeSlotsOutdated)
                {
                    FillGridWebSchedNewPatApptTimeSlotsThreaded();
                }
            }));
            _threadFillGridWebSchedNewPatApptTimeSlots.Start(true);
        }
Exemple #29
0
        ///<summary>Gets all tasklists for a given parent.  But the 5 trunks don't have parents: For main trunk use date.Min and Parent=0.  For Repeating trunk use date.Min isRepeating and Parent=0.  For the 3 dated trunks, use a date and a dateType.  Date and parent are mutually exclusive.  Also used to get all repeating lists for one dateType without any heirarchy: supply parent=-1.</summary>
        public static TaskList[] Refresh(int parent, DateTime date, TaskDateType dateType, bool isRepeating)
        {
            DateTime dateFrom = DateTime.MinValue;
            DateTime dateTo   = DateTime.MaxValue;

            string where = "";
            if (date.Year > 1880)
            {
                //date supplied always indicates one of 3 dated trunks.
                //the value of parent is completely ignored
                if (dateType == TaskDateType.Day)
                {
                    dateFrom = date;
                    dateTo   = date;
                }
                else if (dateType == TaskDateType.Week)
                {
                    dateFrom = date.AddDays(-(int)date.DayOfWeek);
                    dateTo   = dateFrom.AddDays(6);
                }
                else if (dateType == TaskDateType.Month)
                {
                    dateFrom = new DateTime(date.Year, date.Month, 1);
                    dateTo   = dateFrom.AddMonths(1).AddDays(-1);
                }
                where = "DateTL >= " + POut.PDate(dateFrom)
                        + " AND DateTL <= " + POut.PDate(dateTo) + " "
                        + "AND DateType=" + POut.PInt((int)dateType) + " ";
            }
            else                 //no date supplied.
            {
                if (parent == 0) //main trunk or repeating trunk
                {
                    where = "Parent=" + POut.PInt(parent)
                            + " AND DateTL < '1880-01-01'"
                            + " AND IsRepeating=" + POut.PBool(isRepeating) + " ";
                }
                else if (parent == -1 && isRepeating)               //all repeating items with no heirarchy
                {
                    where = "IsRepeating=1 "
                            + "AND DateType=" + POut.PInt((int)dateType) + " ";
                }
                else                  //any child
                {
                    where = "Parent=" + POut.PInt(parent) + " ";
                    //+" AND IsRepeating="+POut.PBool(isRepeating)+" ";
                }
            }
            string command =
                "SELECT * FROM tasklist "
                + "WHERE " + where
                + "ORDER BY DateTimeEntry";
            DataTable table = General.GetTable(command);

            TaskList[] List = new TaskList[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                List[i]               = new TaskList();
                List[i].TaskListNum   = PIn.PInt(table.Rows[i][0].ToString());
                List[i].Descript      = PIn.PString(table.Rows[i][1].ToString());
                List[i].Parent        = PIn.PInt(table.Rows[i][2].ToString());
                List[i].DateTL        = PIn.PDate(table.Rows[i][3].ToString());
                List[i].IsRepeating   = PIn.PBool(table.Rows[i][4].ToString());
                List[i].DateType      = (TaskDateType)PIn.PInt(table.Rows[i][5].ToString());
                List[i].FromNum       = PIn.PInt(table.Rows[i][6].ToString());
                List[i].ObjectType    = (TaskObjectType)PIn.PInt(table.Rows[i][7].ToString());
                List[i].DateTimeEntry = PIn.PDateT(table.Rows[i][8].ToString());
            }
            return(List);
        }
Exemple #30
0
        private void FillGrid()
        {
            int selectedProvNum = 0;

            if (gridMain.SelectedIndices.Length == 1)
            {
                selectedProvNum = PIn.PInt(table.Rows[gridMain.SelectedIndices[0]]["ProvNum"].ToString());
            }
            int scroll = gridMain.ScrollValue;

            Providers.Refresh();
            int schoolClass = 0;

            if (groupDentalSchools.Visible && comboClass.SelectedIndex > 0)
            {
                schoolClass = SchoolClasses.List[comboClass.SelectedIndex - 1].SchoolClassNum;
            }
            bool isAlph = false;

            if (groupDentalSchools.Visible && checkAlphabetical.Checked)
            {
                isAlph = true;
            }
            table = Providers.Refresh(schoolClass, isAlph);
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableProviders", "Abbrev"), 60);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableProviders", "Last Name"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableProviders", "First Name"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableProviders", "User Name"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableProviders", "Hidden"), 50, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            if (!PrefB.GetBool("EasyHideDentalSchools"))
            {
                col = new ODGridColumn(Lan.g("TableProviders", "Class"), 90);
                gridMain.Columns.Add(col);
            }
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(table.Rows[i]["Abbr"].ToString());
                row.Cells.Add(table.Rows[i]["LName"].ToString());
                row.Cells.Add(table.Rows[i]["FName"].ToString());
                row.Cells.Add(table.Rows[i]["UserName"].ToString());
                if (table.Rows[i]["IsHidden"].ToString() == "1")
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                if (!PrefB.GetBool("EasyHideDentalSchools"))
                {
                    if (table.Rows[i]["GradYear"].ToString() != "")
                    {
                        row.Cells.Add(table.Rows[i]["GradYear"].ToString() + "-" + table.Rows[i]["Descript"].ToString());
                    }
                    else
                    {
                        row.Cells.Add("");
                    }
                }
                //row.Tag
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            for (int i = 0; i < table.Rows.Count; i++)
            {
                if (table.Rows[i]["ProvNum"].ToString() == selectedProvNum.ToString())
                {
                    gridMain.SetSelected(i, true);
                    break;
                }
            }
            gridMain.ScrollValue = scroll;
        }