///<summary>Save changes to orderItems based on input in grid.</summary> //private bool saveChangesHelper() { // if(gridItems.Rows.Count==0) { // return true; // } // //validate ------------------------------------------------------------------------ // for(int i=0;i<gridItems.Rows.Count;i++) { // int qtyThisRow=0; // double priceThisRow=0; // if(gridItems.Rows[i].Cells[2].Text!=""){ // try{ // qtyThisRow=Int32.Parse(gridItems.Rows[i].Cells[2].Text); // } // catch{ // MsgBox.Show(this,"Please fix errors in Qty column first."); // return false; // } // } // if(gridItems.Rows[i].Cells[3].Text!=""){ // try{ // priceThisRow=double.Parse(gridItems.Rows[i].Cells[3].Text); // } // catch{ // MsgBox.Show(this,"Please fix errors in Price column first."); // return false; // } // } // } // //Save changes--------------------------------------------------------------------------- // //List<SupplyOrderItem> listOrderItems=OpenDentBusiness.Crud.SupplyOrderItemCrud.TableToList(tableOrderItems);//turn table into list of supplyOrderItem objects // for(int i=0;i<gridItems.Rows.Count;i++) { // int qtyThisRow=PIn.Int(gridItems.Rows[i].Cells[2].Text);//already validated // double priceThisRow=PIn.Double(gridItems.Rows[i].Cells[3].Text);//already validated // if(qtyThisRow==PIn.Int(tableOrderItems.Rows[i]["Qty"].ToString()) // && priceThisRow==PIn.Double(tableOrderItems.Rows[i]["Price"].ToString())) // { // continue;//no changes to order item. // } // SupplyOrderItem soi=new SupplyOrderItem(); // soi.SupplyNum=PIn.Long(tableOrderItems.Rows[i]["SupplyNum"].ToString()); // soi.SupplyOrderItemNum=PIn.Long(tableOrderItems.Rows[i]["SupplyOrderItemNum"].ToString()); // soi.SupplyOrderNum=ListOrders[gridOrders.GetSelectedIndex()].SupplyOrderNum; // soi.Qty=qtyThisRow; // soi.Price=priceThisRow; // SupplyOrderItems.Update(soi); // }//end gridItems // SupplyOrders.UpdateOrderPrice(ListOrders[gridOrders.GetSelectedIndex()].SupplyOrderNum); // int selectedIndex=gridOrders.GetSelectedIndex(); // ListOrdersAll = SupplyOrders.GetAll();//update new totals // FillGridOrders(); // if(selectedIndex!=-1) { // gridOrders.SetSelected(selectedIndex,true); // } // return true; //} private void gridItems_CellLeave(object sender, ODGridClickEventArgs e) { //no need to check which cell was edited, just reprocess both cells int qtyNew = 0; //default value. try { qtyNew = PIn.Int(gridItems.Rows[e.Row].Cells[2].Text); //0 if not valid input } catch { } double priceNew = PIn.Double(gridItems.Rows[e.Row].Cells[3].Text); //0 if not valid input SupplyOrderItem suppOI = SupplyOrderItems.CreateObject(PIn.Long(_tableOrderItems.Rows[e.Row]["SupplyOrderItemNum"].ToString())); suppOI.Qty = qtyNew; suppOI.Price = priceNew; SupplyOrderItems.Update(suppOI); SupplyOrders.UpdateOrderPrice(suppOI.SupplyOrderNum); gridItems.Rows[e.Row].Cells[2].Text = qtyNew.ToString(); //to standardize formatting. They probably didn't type .00 gridItems.Rows[e.Row].Cells[3].Text = priceNew.ToString("n"); //to standardize formatting. They probably didn't type .00 gridItems.Rows[e.Row].Cells[4].Text = (qtyNew * priceNew).ToString("n"); //to standardize formatting. They probably didn't type .00 gridItems.Invalidate(); int si = gridOrders.GetSelectedIndex(); _listOrdersAll = SupplyOrders.GetAll(); FillGridOrders(); gridOrders.SetSelected(si, true); }
private bool SaveJobSprint() { if (textDateStart.errorProvider1.GetError(textDateStart) != "" || textDateEnd.errorProvider1.GetError(textDateEnd) != "" || textEngJobPercent.errorProvider1.GetError(textEngJobPercent) != "" || textAvgDevelopmentHours.errorProvider1.GetError(textAvgDevelopmentHours) != "" || textBreakHours.errorProvider1.GetError(textBreakHours) != "") { MsgBox.Show(this, "Please fix sprint settings before saving."); return(false); } _jobSprintCur.Title = textTitle.Text; _jobSprintCur.DateStart = PIn.Date(textDateStart.Text); _jobSprintCur.DateEndTarget = PIn.Date(textDateEnd.Text); _jobSprintCur.JobPercent = PIn.Double(textEngJobPercent.Text); _jobSprintCur.HoursAverageDevelopment = PIn.Double(textAvgDevelopmentHours.Text); _jobSprintCur.HoursAverageBreak = PIn.Double(textBreakHours.Text); _jobSprintCur.Note = textNote.Text; JobSprints.Update(_jobSprintCur); _hasUnsavedChanges = false; if (SaveClick != null) { SaveClick(this, new EventArgs()); } return(true); }
private void butOK_Click(object sender, EventArgs e) { if (textFee.errorProvider1.GetError(textFee) != "") { MsgBox.Show(this, "Please enter a valid fee."); return; } if (textDateNextClaim.errorProvider1.GetError(textDateNextClaim) != "") { MsgBox.Show(this, "Please enter a valid date."); return; } if (checkUseDefaultFee.Checked) { _patPlanCur.OrthoAutoFeeBilledOverride = -1; } else { _patPlanCur.OrthoAutoFeeBilledOverride = PIn.Double(textFee.Text); } if (textDateNextClaim.Visible) { _patPlanCur.OrthoAutoNextClaimDate = PIn.Date(textDateNextClaim.Text); //MinValue if blank. } DialogResult = DialogResult.OK; }
public static GridRow CreateRowForPaySplit(DataRow rowBundlePayment, PaySplit paySplit, bool isDynamic = false) { string descript = Defs.GetName(DefCat.PaymentTypes, PIn.Long(rowBundlePayment["PayType"].ToString())); if (rowBundlePayment["CheckNum"].ToString() != "") { descript += " #" + rowBundlePayment["CheckNum"].ToString(); } descript += " " + paySplit.SplitAmt.ToString("c"); if (PIn.Double(rowBundlePayment["PayAmt"].ToString()) != paySplit.SplitAmt) { descript += Lans.g("PayPlanL", "(split)"); } GridRow row = new GridRow(); row.Cells.Add(paySplit.DatePay.ToShortDateString()); //0 Date row.Cells.Add(Providers.GetAbbr(PIn.Long(rowBundlePayment["ProvNum"].ToString()))); //1 Prov Abbr row.Cells.Add(descript); //2 Descript row.Cells.Add(""); //3 Principal row.Cells.Add(""); //4 Interest row.Cells.Add(""); //5 Due row.Cells.Add(paySplit.SplitAmt.ToString("n")); //6 Payment if (!isDynamic) { row.Cells.Add(""); //7 Adjustment - Does not exist for dynamic payment plans } row.Cells.Add(""); //8 Balance (filled later) row.Tag = paySplit; row.ColorText = Defs.GetDefByExactName(DefCat.AccountColors, "Payment").ItemColor; return(row); }
private void butOK_Click(object sender, System.EventArgs e) { if (textFee.errorProvider1.GetError(textFee) != "") { MessageBox.Show(Lan.g(this, "Please fix data entry error first.")); return; } DateTime datePrevious = FeeCur.SecDateTEdit; if (textFee.Text == "") { Fees.Delete(FeeCur); } else { FeeCur.Amount = PIn.Double(textFee.Text); //Fee object always created and inserted externally first Fees.Update(FeeCur); } SecurityLogs.MakeLogEntry(Permissions.ProcFeeEdit, 0, Lan.g(this, "Procedure") + ": " + ProcedureCodes.GetStringProcCode(FeeCur.CodeNum) + ", " + Lan.g(this, "Fee: ") + "" + FeeCur.Amount.ToString("c") + ", " + Lan.g(this, "Fee Schedule") + ": " + FeeScheds.GetDescription(FeeCur.FeeSched) + ". " + Lan.g(this, "Manual edit in Edit Fee window."), FeeCur.CodeNum, DateTime.MinValue); SecurityLogs.MakeLogEntry(Permissions.LogFeeEdit, 0, Lan.g(this, "Fee Updated"), FeeCur.FeeNum, datePrevious); //FeeCur.UseDefaultCov=checkDefCov.Checked; //FeeCur.UseDefaultFee=checkDefFee.Checked; DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { if (textDateAgreement.errorProvider1.GetError(textDateAgreement) != "" || textDateFirstPay.errorProvider1.GetError(textDateFirstPay) != "") { MsgBox.Show(this, "Please enter valid dates."); return; } if (textMonthlyPayment.errorProvider1.GetError(textMonthlyPayment) != "") { MsgBox.Show(this, "Please enter a valid monthly payment."); return; } if (textAPR.errorProvider1.GetError(textAPR) != "") { MsgBox.Show(this, "Please enter a valid annual percentage rate (APR)."); return; } InstallmentPlanCur.DateAgreement = PIn.Date(textDateAgreement.Text); InstallmentPlanCur.DateFirstPayment = PIn.Date(textDateFirstPay.Text); InstallmentPlanCur.MonthlyPayment = PIn.Double(textMonthlyPayment.Text); InstallmentPlanCur.APR = PIn.Float(textAPR.Text); InstallmentPlanCur.Note = PIn.String(textNote.Text); if (IsNew) { InstallmentPlans.Insert(InstallmentPlanCur); } else { InstallmentPlans.Update(InstallmentPlanCur); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { if (textFeeAmt.errorProvider1.GetError(textFeeAmt) != "" || textPriInsAmt.errorProvider1.GetError(textPriInsAmt) != "" || textSecInsAmt.errorProvider1.GetError(textSecInsAmt) != "" || textDiscount.errorProvider1.GetError(textDiscount) != "" || textPatAmt.errorProvider1.GetError(textPatAmt) != "" ) { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (comboPriority.SelectedIndex == 0) { ProcCur.Priority = 0; } else { ProcCur.Priority = DefC.Short[(int)DefCat.TxPriorities][comboPriority.SelectedIndex - 1].DefNum; } ProcCur.ToothNumTP = textToothNumTP.Text; ProcCur.Surf = textSurf.Text; ProcCur.ProcCode = textCode.Text; ProcCur.Descript = textDescript.Text; ProcCur.FeeAmt = PIn.Double(textFeeAmt.Text); ProcCur.PriInsAmt = PIn.Double(textPriInsAmt.Text); ProcCur.SecInsAmt = PIn.Double(textSecInsAmt.Text); ProcCur.Discount = PIn.Double(textDiscount.Text); ProcCur.PatAmt = PIn.Double(textPatAmt.Text); ProcCur.Prognosis = textPrognosis.Text; ProcCur.Dx = textDx.Text; ProcTPs.InsertOrUpdate(ProcCur, false); //IsNew not applicable here SecurityLogs.MakeLogEntry(Permissions.TreatPlanEdit, ProcCur.PatNum, "Edit proc: " + ProcCur.Descript); DialogResult = DialogResult.OK; }
/// <summary>Returns true if a finance charge is added, false if one is not added</summary> private bool AddFinanceCharge(long PatNum, DateTime date, string APR, string atLeast, string ifOver, double OverallBalance, long PriProv, long adjType) { if (date > DateTime.Today && !PrefC.GetBool(PrefName.FutureTransDatesAllowed)) { MsgBox.Show(this, "Adjustments cannot be made for future dates. Finance charge was not added."); return(false); } InstallmentPlan installPlan = InstallmentPlans.GetOneForFam(PatNum); if (installPlan != null) //Patient has an installment plan so use that APR instead. { APR = installPlan.APR.ToString(); } Adjustment AdjustmentCur = new Adjustment(); AdjustmentCur.PatNum = PatNum; //AdjustmentCur.DateEntry=PIn.PDate(textDate.Text);//automatically handled AdjustmentCur.AdjDate = date; AdjustmentCur.ProcDate = date; AdjustmentCur.AdjType = adjType; AdjustmentCur.AdjNote = ""; //"Finance Charge"; AdjustmentCur.AdjAmt = Math.Round(((PIn.Double(APR) * .01d / 12d) * OverallBalance), 2); if (AdjustmentCur.AdjAmt.IsZero() || AdjustmentCur.AdjAmt < PIn.Double(ifOver)) { //Don't add the charge if it is less than FinanceChargeOnlyIfOver; if the charge is exactly equal to FinanceChargeOnlyIfOver, //the charge will be added. Ex., AdjAmt=2.00 and FinanceChargeOnlyIfOver=2.00, the charge will be added. //Unless AdjAmt=0.00, in which case don't add a $0.00 finance charge return(false); } //Add an amount that is at least the amount of FinanceChargeAtLeast AdjustmentCur.AdjAmt = Math.Max(AdjustmentCur.AdjAmt, PIn.Double(atLeast)); AdjustmentCur.ProvNum = PriProv; Adjustments.Insert(AdjustmentCur); return(true); }
private void butOK_Click(object sender, EventArgs e) { if (textConcept.errorProvider1.GetError(textConcept) != "" || textWriteup.errorProvider1.GetError(textWriteup) != "" || textDevelopment.errorProvider1.GetError(textDevelopment) != "" || textReview.errorProvider1.GetError(textReview) != "") { MsgBox.Show(this, "Please enter valid hour estimates before attempting to save."); return; } Job jobOld = JobCur.Copy(); JobCur.HoursEstimateConcept = PIn.Double(textConcept.Text); JobCur.HoursEstimateWriteup = PIn.Double(textWriteup.Text); JobCur.HoursEstimateDevelopment = PIn.Double(textDevelopment.Text); JobCur.HoursEstimateReview = PIn.Double(textReview.Text); if (JobLogs.MakeLogEntryForEstimateChange(JobCur, jobOld, textNote.Text)) { DialogResult = DialogResult.OK; } else { DialogResult = DialogResult.Cancel; } }
private void butOK_Click(object sender, EventArgs e) { if (textLevelDesired.errorProvider1.GetError(textLevelDesired) != "" || textPrice.errorProvider1.GetError(textPrice) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textDescript.Text == "") { MsgBox.Show(this, "Please enter a description."); return; } Supp.Category = DefC.Short[(int)DefCat.SupplyCats][comboCategory.SelectedIndex].DefNum; Supp.CatalogNumber = textCatalogNumber.Text; Supp.Descript = textDescript.Text; Supp.LevelDesired = PIn.Float(textLevelDesired.Text); Supp.Price = PIn.Double(textPrice.Text); Supp.IsHidden = checkIsHidden.Checked; if (Supp.Category != categoryInitialVal) { Supp.ItemOrder = int.MaxValue; //changed categories, new or existing, move to bottom of new category. } if (Supp.IsNew) { Supp = Supplies.GetSupply(Supplies.Insert(Supp, Supp.ItemOrder)); //insert Supp and update with PK and item order from DB. } else { Supplies.Update(SuppOriginal, Supp); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { if (textLevelDesired.errorProvider1.GetError(textLevelDesired) != "" || textPrice.errorProvider1.GetError(textPrice) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textDescript.Text == "") { MsgBox.Show(this, "Please enter a description."); return; } Supp.Category = _listSupplyCatDefs[comboCategory.SelectedIndex].DefNum; Supp.CatalogNumber = textCatalogNumber.Text; Supp.Descript = textDescript.Text; Supp.LevelDesired = PIn.Float(textLevelDesired.Text); Supp.LevelOnHand = PIn.Float(textLevelOnHand.Text); Supp.Price = PIn.Double(textPrice.Text); Supp.IsHidden = checkIsHidden.Checked; if (Supp.Category != categoryInitialVal) { Supp.ItemOrder = int.MaxValue; //changed categories, new or existing, move to bottom of new category. } //No longer saving changes from this form. DialogResult = DialogResult.OK; }
///<Summary>Surround with try-catch.</Summary> private void SaveGridChanges() { //validate all grid cells double dbl; int toothIndexOffset = 0; if (Clinics.IsMedicalPracticeOrClinic(Clinics.ClinicNum)) { toothIndexOffset = 1; } for (int i = 0; i < gridMain.ListGridRows.Count; i++) { if (gridMain.ListGridRows[i].Cells[4 - toothIndexOffset].Text != "") { try{ dbl = Convert.ToDouble(gridMain.ListGridRows[i].Cells[4 - toothIndexOffset].Text); } catch { throw new ApplicationException(Lan.g(this, "Amount not valid: ") + gridMain.ListGridRows[i].Cells[4 - toothIndexOffset].Text); } } } for (int i = 0; i < ClaimProcsToEdit.Count; i++) { ClaimProcsToEdit[i].InsPayEst = PIn.Double(gridMain.ListGridRows[i].Cells[4 - toothIndexOffset].Text); ClaimProcsToEdit[i].Remarks = gridMain.ListGridRows[i].Cells[5 - toothIndexOffset].Text; } }
private void butOK_Click(object sender, EventArgs e) { if (textDatePlaced.errorProvider1.GetError(textDatePlaced) != "" || textAmountTotal.errorProvider1.GetError(textAmountTotal) != "" || textShippingCharge.errorProvider1.GetError(textShippingCharge) != "" || !textDateReceived.IsValid) { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textDatePlaced.Text == "") { SupplyOrderCur.DatePlaced = new DateTime(2500, 1, 1); SupplyOrderCur.UserNum = 0; //even if they had set a user, set it back because the order hasn't been placed. } else { SupplyOrderCur.DatePlaced = PIn.Date(textDatePlaced.Text); SupplyOrderCur.UserNum = comboUser.GetSelectedKey <Userod>(x => x.UserNum); } SupplyOrderCur.AmountTotal = PIn.Double(textAmountTotal.Text); SupplyOrderCur.Note = textNote.Text; SupplyOrderCur.ShippingCharge = PIn.Double(textShippingCharge.Text); SupplyOrderCur.DateReceived = PIn.Date(textDateReceived.Text); SupplyOrders.Update(SupplyOrderCur); //never new DialogResult = DialogResult.OK; }
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; } long patNum = PIn.Long(_tableTrans.Rows[gridMain.SelectedIndices[0]]["PatNum"].ToString()); long xWebResponseNum = PIn.Long(_tableTrans.Rows[gridMain.SelectedIndices[0]]["XWebResponseNum"].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(); try { Cursor = Cursors.WaitCursor; XWebs.VoidPayment(patNum, payNote, xWebResponseNum); Cursor = Cursors.Default; MsgBox.Show(this, "Void successful"); FillGrid(); } catch (ODException ex) { Cursor = Cursors.Default; MessageBox.Show(ex.Message); } }
private void butOK_Click(object sender, System.EventArgs e) { if (textChargeAmt.errorProvider1.GetError(textChargeAmt) != "" || textDateStart.errorProvider1.GetError(textDateStart) != "" || textDateStop.errorProvider1.GetError(textDateStop) != "" ) { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textDateStart.Text == "") { MsgBox.Show(this, "Start date cannot be left blank."); return; } if (PIn.Date(textDateStart.Text) < DateTime.Today.AddMonths(-1)) { MsgBox.Show(this, "Start date cannot be more than a month in the past. But you can still enter previous charges manually in the account."); return; } RepeatCur.ProcCode = textCode.Text; RepeatCur.ChargeAmt = PIn.Double(textChargeAmt.Text); RepeatCur.DateStart = PIn.Date(textDateStart.Text); RepeatCur.DateStop = PIn.Date(textDateStop.Text); RepeatCur.Note = textNote.Text; if (IsNew) { RepeatCharges.Insert(RepeatCur); } else { RepeatCharges.Update(RepeatCur); } DialogResult = DialogResult.OK; }
///<Summary>Fails silently if text is in invalid format.</Summary> private void FillTotals() { double claimFee = 0; double labFees = 0; double dedApplied = 0; double insPayAmtAllowed = 0; double insPayAmt = 0; double writeOff = 0; //double amt; for (int i = 0; i < gridMain.ListGridRows.Count; i++) { claimFee += ClaimProcsToEdit[i].FeeBilled; //5 if (CultureInfo.CurrentCulture.Name.EndsWith("CA")) //Canadian. en-CA or fr-CA { labFees += PIn.Double(gridMain.ListGridRows[i].Cells[gridMain.ListGridColumns.GetIndex(Lan.g("TableClaimProc", "Labs"))].Text); } dedApplied += PIn.Double(gridMain.ListGridRows[i].Cells[gridMain.ListGridColumns.GetIndex(Lan.g("TableClaimProc", "Deduct"))].Text); insPayAmtAllowed += PIn.Double(gridMain.ListGridRows[i].Cells[gridMain.ListGridColumns.GetIndex(Lan.g("TableClaimProc", "Allowed"))].Text); insPayAmt += PIn.Double(gridMain.ListGridRows[i].Cells[gridMain.ListGridColumns.GetIndex(Lan.g("TableClaimProc", "Ins Pay"))].Text); writeOff += PIn.Double(gridMain.ListGridRows[i].Cells[gridMain.ListGridColumns.GetIndex(Lan.g("TableClaimProc", "Writeoff"))].Text); } textClaimFee.Text = claimFee.ToString("F"); textLabFees.Text = labFees.ToString("F"); textDedApplied.Text = dedApplied.ToString("F"); textInsPayAllowed.Text = insPayAmtAllowed.ToString("F"); textInsPayAmt.Text = insPayAmt.ToString("F"); textWriteOff.Text = writeOff.ToString("F"); }
private void butOK_Click(object sender, EventArgs e) { try { if (PIn.Double(textBoxXPos.Text) < 0) { textBoxXPos.Focus(); MessageBox.Show(Lan.g(this, "Invalid XPos")); return; } if (PIn.Double(textBoxYPos.Text) < 0) { textBoxYPos.Focus(); MessageBox.Show(Lan.g(this, "Invalid YPos")); return; } if (PIn.Double(textBoxWidthFeet.Text) <= 0) { textBoxWidthFeet.Focus(); MessageBox.Show(Lan.g(this, "Invalid Width")); return; } if (PIn.Double(textBoxHeightFeet.Text) <= 0) { textBoxHeightFeet.Focus(); MessageBox.Show(Lan.g(this, "Invalid Height")); return; } if (PIn.Int(textBoxExtension.Text) < 0) { textBoxExtension.Focus(); MessageBox.Show(Lan.g(this, "Invalid Extension")); return; } if (MapItem.ItemType == MapItemType.DisplayLabel && PIn.String(textBoxDescription.Text) == "") { textBoxDescription.Focus(); MessageBox.Show(Lan.g(this, "Invalid Text")); return; } MapItem.Extension = PIn.Int(textBoxExtension.Text); MapItem.XPos = PIn.Double(textBoxXPos.Text); MapItem.YPos = PIn.Double(textBoxYPos.Text); MapItem.Width = PIn.Double(textBoxWidthFeet.Text); MapItem.Height = PIn.Double(textBoxHeightFeet.Text); MapItem.Description = PIn.String(textBoxDescription.Text); if (MapItem.IsNew) { MapAreas.Insert(MapItem); } else { MapAreas.Update(MapItem); } DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
///<summary>Adds the passed in pat fields to the grid. Adds any fields that have been renamed at the end of the grid if the preference is ///enabled. The tag on the row will be the PatFieldDef or the PatField if the PatFieldDef has been renamed.</summary> public static void AddPatFieldsToGrid(ODGrid grid, List <PatField> listPatFields, FieldLocations fieldLocation, List <FieldDefLink> listFieldDefLinks = null) { List <PatFieldDef> listPatFieldDefs = PatFieldDefs.GetDeepCopy(true); listFieldDefLinks = listFieldDefLinks ?? FieldDefLinks.GetForLocation(fieldLocation) .FindAll(x => x.FieldDefType == FieldDefTypes.Patient); //Add a row for each existing PatFieldDef foreach (PatFieldDef patFieldDef in listPatFieldDefs) { if (listFieldDefLinks.Exists(x => x.FieldDefNum == patFieldDef.PatFieldDefNum)) { continue; } ODGridRow row = new ODGridRow(); PatField field = listPatFields.FirstOrDefault(x => x.FieldName == patFieldDef.FieldName); if (patFieldDef.FieldType.ToString() == "InCaseOfEmergency") { //Deprecated. Should never happen. continue; } row.Cells.Add(patFieldDef.FieldName); if (field == null) { row.Cells.Add(""); } else { if (patFieldDef.FieldType == PatFieldType.Checkbox) { row.Cells.Add("X"); } else if (patFieldDef.FieldType == PatFieldType.Currency) { row.Cells.Add(PIn.Double(field.FieldValue).ToString("c")); } else { row.Cells.Add(field.FieldValue); } } row.Tag = patFieldDef; grid.Rows.Add(row); } if (!PrefC.GetBool(PrefName.DisplayRenamedPatFields)) { return; } //Now loop through the PatFields that do not have a matching PatFieldDef. foreach (PatField patField in listPatFields.Where(x => !listPatFieldDefs.Any(y => y.FieldName == x.FieldName))) { ODGridRow row = new ODGridRow(); row.Cells.Add(patField.FieldName); row.Cells.Add(patField.FieldValue); row.Tag = patField; row.ColorText = Color.DarkSlateGray; grid.Rows.Add(row); } }
private MigraDoc.DocumentObjectModel.Document CreatePrintDocument(PrintDocument pd) { string text; MigraDoc.DocumentObjectModel.Document doc = new MigraDoc.DocumentObjectModel.Document(); doc.DefaultPageSetup.PageWidth = Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Width / 100); doc.DefaultPageSetup.PageHeight = Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Height / 100); doc.DefaultPageSetup.TopMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Top / 100); doc.DefaultPageSetup.LeftMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Left / 100); doc.DefaultPageSetup.RightMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Right / 100); doc.DefaultPageSetup.BottomMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Bottom / 100); MigraDoc.DocumentObjectModel.Section section = doc.AddSection(); section.PageSetup.StartingNumber = 1; MigraDoc.DocumentObjectModel.Font headingFont = MigraDocHelper.CreateFont(13, true); MigraDoc.DocumentObjectModel.Font bodyFontx = MigraDocHelper.CreateFont(9, false); MigraDoc.DocumentObjectModel.Font nameFontx = MigraDocHelper.CreateFont(9, true); MigraDoc.DocumentObjectModel.Font totalFontx = MigraDocHelper.CreateFont(9, true); Paragraph pageNumParag = new Paragraph(); pageNumParag.AddText(Lan.g(this, "Page") + " "); pageNumParag.AddPageField(); pageNumParag.AddText(" " + Lan.g(this, "of") + " "); pageNumParag.AddNumPagesField(); section.Footers.Primary.Add(pageNumParag); Paragraph par = section.AddParagraph(); ParagraphFormat parformat = new ParagraphFormat(); parformat.Alignment = ParagraphAlignment.Center; parformat.Font = MigraDocHelper.CreateFont(14, true); par.Format = parformat; //Render the reconcile grid. par = section.AddParagraph(); par.Format.Alignment = ParagraphAlignment.Center; par.AddFormattedText(Lan.g(this, "RECONCILE"), totalFontx); par.AddLineBreak(); text = Accounts.GetAccount(ReconcileCur.AccountNum).Description.ToUpper(); par.AddFormattedText(text, totalFontx); par.AddLineBreak(); text = PrefC.GetString(PrefName.PracticeTitle); par.AddText(text); par.AddLineBreak(); text = PrefC.GetString(PrefName.PracticePhone); if (text.Length == 10 && Application.CurrentCulture.Name == "en-US") { text = "(" + text.Substring(0, 3) + ")" + text.Substring(3, 3) + "-" + text.Substring(6); } par.AddText(text); par.AddLineBreak(); par.AddText(MiscData.GetNowDateTime().ToShortDateString()); par.AddLineBreak(); par.AddText(Lan.g(this, "Reconcile Date") + ": " + PIn.Date(textDate.Text).ToShortDateString()); par.AddLineBreak(); par.AddText(labelStart.Text + ": " + PIn.Double(textStart.Text).ToString("n")); par.AddLineBreak(); par.AddText(labelEnd.Text + ": " + PIn.Double(textEnd.Text).ToString("n")); MigraDocHelper.InsertSpacer(section, 10); MigraDocHelper.DrawGrid(section, gridMain); return(doc); }
private void SheetFilterChanged() { if (_sheetDefCur.SheetType.GetAttributeOrDefault <SheetLayoutAttribute>().IsDynamic&& SheetFieldDefCur.FieldName == "toothChart") { int height = (int)Math.Round(PIn.Double(textWidth.Text) * ToothChartData.SizeOriginalDrawing.Height) / ToothChartData.SizeOriginalDrawing.Width; textHeight.Text = POut.Int(height); } }
private void FillGrid() { RefreshReport(); gridMain.BeginUpdate(); ODGridColumn col = null; if (gridMain.Columns.Count == 0) { col = new ODGridColumn(Lan.g(this, "Patient Name"), _colWidthPatName); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Procedure Date"), _colWidthProcDate); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Procedure Descipion"), 0); //Dynaimc width gridMain.Columns.Add(col); if (PrefC.HasClinicsEnabled) { col = new ODGridColumn(Lan.g(this, "Clinic"), _colWidthClinic); gridMain.Columns.Add(col); } col = new ODGridColumn(Lan.g(this, "Amount"), _colWidthAmount, HorizontalAlignment.Right); gridMain.Columns.Add(col); } gridMain.Rows.Clear(); ODGridRow row; for (int i = 0; i < _myReport.ReportObjects.Count; i++) { if (_myReport.ReportObjects[i].ObjectType != ReportObjectType.QueryObject) { continue; } QueryObject queryObj = (QueryObject)_myReport.ReportObjects[i]; for (int j = 0; j < queryObj.ReportTable.Rows.Count; j++) { row = new ODGridRow(); row.Cells.Add(queryObj.ReportTable.Rows[j][0].ToString()); //Procedure Name row.Cells.Add(PIn.Date(queryObj.ReportTable.Rows[j][1].ToString()).ToShortDateString()); //Procedure Date row.Cells.Add(queryObj.ReportTable.Rows[j][2].ToString()); //Procedure Description if (PrefC.HasClinicsEnabled) { long clinicNum = PIn.Long(queryObj.ReportTable.Rows[j][5].ToString()); if (clinicNum == 0) { row.Cells.Add("Unassigned"); } else { row.Cells.Add(Clinics.GetAbbr(clinicNum)); } } row.Cells.Add(PIn.Double(queryObj.ReportTable.Rows[j][3].ToString()).ToString("c")); //Amount _procTotalAmt += PIn.Decimal(queryObj.ReportTable.Rows[j][3].ToString()); row.Tag = PIn.Long(queryObj.ReportTable.Rows[j][4].ToString()); //Tag set to ProcNum. Used in butNewClaims_Click(). gridMain.Rows.Add(row); } } gridMain.EndUpdate(); }
private void butImport_Click(object sender, EventArgs e) { if (!MsgBox.Show(this, true, "If you want a clean slate, the current fee schedule should be cleared first. When imported, any fees that are found in the text file will overwrite values of the current fee schedule showing in the main window. Are you sure you want to continue?")) { return; } Cursor = Cursors.WaitCursor; OpenFileDialog Dlg = new OpenFileDialog(); if (Directory.Exists(PrefC.GetString(PrefName.ExportPath))) { Dlg.InitialDirectory = PrefC.GetString(PrefName.ExportPath); } else if (Directory.Exists("C:\\")) { Dlg.InitialDirectory = "C:\\"; } if (Dlg.ShowDialog() != DialogResult.OK) { Cursor = Cursors.Default; return; } if (!File.Exists(Dlg.FileName)) { Cursor = Cursors.Default; MsgBox.Show(this, "File not found"); return; } string[] fields; double feeAmt; using (StreamReader sr = new StreamReader(Dlg.FileName)){ string line = sr.ReadLine(); while (line != null) { Cursor = Cursors.WaitCursor; fields = line.Split(new string[1] { "\t" }, StringSplitOptions.None); if (fields.Length > 1) // && fields[1]!=""){//we no longer skip blank fees { if (fields[1] == "") { feeAmt = -1; //triggers deletion of existing fee, but no insert. } else { feeAmt = PIn.Double(fields[1]); } Fees.Import(fields[0], feeAmt, SchedNum); } line = sr.ReadLine(); } } DataValid.SetInvalid(InvalidType.Fees); Cursor = Cursors.Default; DialogResult = DialogResult.OK; }
private void FillGrid() { gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); GridColumn col = new GridColumn(Lan.g("TableInvoiceItems", "Date"), 70); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableInvoiceItems", "PatName"), 100); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableInvoiceItems", "Prov"), 55); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableInvoiceItems", "Code"), 55); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableInvoiceItems", "Tooth"), 50); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableInvoiceItems", "Description"), 150); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableInvoiceItems", "Fee"), 60, HorizontalAlignment.Right); gridMain.ListGridColumns.Add(col); gridMain.ListGridRows.Clear(); GridRow row; List <ProcedureCode> listProcCodes = ProcedureCodes.GetAllCodes(); foreach (DataRow tableRow in _tableSuperFamAcct.Rows) { row = new GridRow(); row.Cells.Add(PIn.DateT(tableRow["Date"].ToString()).ToShortDateString()); row.Cells.Add(tableRow["PatName"].ToString()); row.Cells.Add(Providers.GetAbbr(PIn.Long(tableRow["Prov"].ToString()))); if (!string.IsNullOrWhiteSpace(tableRow["AdjType"].ToString())) //It's an adjustment { row.Cells.Add(Lan.g(this, "Adjust")); //Adjustment row.Cells.Add(Tooth.ToInternat(tableRow["Tooth"].ToString())); row.Cells.Add(Defs.GetName(DefCat.AdjTypes, PIn.Long(tableRow["AdjType"].ToString()))); //Adjustment type } else if (!string.IsNullOrWhiteSpace(tableRow["ChargeType"].ToString())) //It's a payplan charge { if (PrefC.GetInt(PrefName.PayPlansVersion) != (int)PayPlanVersions.AgeCreditsAndDebits) { continue; //They can only attach debits to invoices and they can only do so if they're on version 2. } row.Cells.Add(Lan.g(this, "Pay Plan")); row.Cells.Add(Tooth.ToInternat(tableRow["Tooth"].ToString())); row.Cells.Add(PIn.Enum <PayPlanChargeType>(PIn.Int(tableRow["ChargeType"].ToString())).GetDescription()); //Pay Plan charge type } else //It's a procedure { ProcedureCode procCode = ProcedureCodes.GetProcCode(PIn.Long(tableRow["Code"].ToString()), listProcCodes); row.Cells.Add(procCode.ProcCode); row.Cells.Add(Tooth.ToInternat(tableRow["Tooth"].ToString())); row.Cells.Add(procCode.Descript); } row.Cells.Add(PIn.Double(tableRow["Amount"].ToString()).ToString("F")); row.Tag = tableRow; gridMain.ListGridRows.Add(row); } gridMain.EndUpdate(); }
private void FillGrid() { //Currently only working for X-Charge. If more added then move this check out of FillGrid. #region XCharge Check if (prog == null) { MsgBox.Show(this, "X-Charge entry is missing from the database."); //should never happen return; } if (!prog.Enabled) { if (Security.IsAuthorized(Permissions.Setup)) { FormXchargeSetup FormX = new FormXchargeSetup(); FormX.ShowDialog(); } return; } if (!File.Exists(xPath)) { MsgBox.Show(this, "Path is not valid."); if (Security.IsAuthorized(Permissions.Setup)) { FormXchargeSetup FormX = new FormXchargeSetup(); FormX.ShowDialog(); } return; } #endregion table = CreditCards.GetRecurringChargeList(); gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableRecurring", "PatNum"), 110); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableRecurring", "Name"), 250); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableRecurring", "Total Bal"), 90, HorizontalAlignment.Right); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableRecurring", "ChargeAmt"), 100, HorizontalAlignment.Right); gridMain.Columns.Add(col); gridMain.Rows.Clear(); OpenDental.UI.ODGridRow row; for (int i = 0; i < table.Rows.Count; i++) { row = new OpenDental.UI.ODGridRow(); Double famBalTotal = PIn.Double(table.Rows[i]["FamBalTotal"].ToString()); Double chargeAmt = PIn.Double(table.Rows[i]["ChargeAmt"].ToString()); row.Cells.Add(table.Rows[i]["PatNum"].ToString()); row.Cells.Add(table.Rows[i]["PatName"].ToString()); row.Cells.Add(famBalTotal.ToString("c")); row.Cells.Add(chargeAmt.ToString("c")); gridMain.Rows.Add(row); } gridMain.EndUpdate(); labelTotal.Text = Lan.g(this, "Total=") + table.Rows.Count.ToString(); labelSelected.Text = Lan.g(this, "Selected=") + gridMain.SelectedIndices.Length.ToString(); }
///<summary>Updates a selected row with the user selected values. Returns the new RemAfter value for the passed in procedure.</summary> private MultiAdjEntry UpdateAdjValues(MultiAdjEntry row) { Def selectedAdjType; if (listTypePos.SelectedIndex != -1) { selectedAdjType = _listAdjPosCats[listTypePos.SelectedIndex]; } else //Nothing was selected in listTypePos so there has to be a selection for negative. { selectedAdjType = _listAdjNegCats[listTypeNeg.SelectedIndex]; } //set prov if (((ODBoxItem <Provider>)comboProv.SelectedItem).Text == "Inherit") //Inherit was carefully approved by Nathan (and reluctantly Allen) { if (row.Proc != null) { row.Adj.ProvNum = row.Proc.ProvNum; } } else { row.Adj.ProvNum = ((ODBoxItem <Provider>)comboProv.SelectedItem).Tag.ProvNum; } //set clinic long selectedClinicNum = 0; if (PrefC.HasClinicsEnabled) { if (((ODBoxItem <Clinic>)comboClinic.SelectedItem).Text == "Inherit") { if (row.Proc != null) { selectedClinicNum = row.Proc.ClinicNum; } } else { selectedClinicNum = ((ODBoxItem <Clinic>)comboClinic.SelectedItem).Tag.ClinicNum; } } row.Adj.AdjType = selectedAdjType.DefNum; row.Adj.ClinicNum = selectedClinicNum; row.Adj.AdjDate = PIn.Date(dateAdjustment.Text); row.Adj.AdjNote = PIn.String(textNote.Text); row.Adj.PatNum = _patCur.PatNum; if (row.Proc == null) //Unassigned adjustments have to be fixed amounts, or else they will be 0. { row.AdjAmtType = AdjAmtType.FixedAmt; } else { row.AdjAmtType = SetAdjAmtType(); } row.AdjAmtOrPerc = PIn.Double(textAmt.Text); return(row); }
private void butCalculate_Click(object sender, EventArgs e) { if (PIn.Double(textNumOfCharges.Text) == 0 || PIn.Double(textTotalAmount.Text) == 0) { textChargeAmt.Text = RepeatCur.ChargeAmt.ToString("F"); return; } textChargeAmt.Text = (PIn.Double(textTotalAmount.Text) / PIn.Double(textNumOfCharges.Text)).ToString("F"); }
private void butOK_Click(object sender, EventArgs e) { _jobQuote.Note = textNote.Text; _jobQuote.Amount = PIn.Double(textAmount.Text).ToString("F"); _jobQuote.Hours = textQuoteHours.Text; _jobQuote.ApprovedAmount = PIn.Double(textApprovedAmount.Text).ToString("F"); _jobQuote.IsCustomerApproved = checkIsApproved.Checked; DialogResult = DialogResult.OK; }
///<summary>Sets the foreground text to red if any row has a DOS between textDOSFrom and textDOSTo and matches textClaimFee </summary> private void HighlightRows() { DateTime dateFrom = PIn.Date(textDateFrom.Text); DateTime dateTo = PIn.Date(textDateTo.Text); double fee = PIn.Double(textClaimFee.Text); int rowsHighlightCount = 0; int lastHighlightIndex = 0; gridClaims.BeginUpdate(); for (int i = 0; i < gridClaims.Rows.Count; i++) { gridClaims.Rows[i].ColorText = Color.Black; //reset row highlighting gridClaims.Rows[i].Bold = false; //reset row highlighting Claim claim = (Claim)gridClaims.Rows[i].Tag; YN isFeeMatch = YN.No; //If fee matches then yes, if fee doesnt match then no, if no fee entered then unknown YN isDateMatch = YN.No; //If both dates match then yes, if both dates dont match then no, if no dates entered then unknown //Check fee if (textClaimFee.Text == "") //No fee entered { isFeeMatch = YN.Unknown; } else { if (claim.ClaimFee.ToString("f").Contains(textClaimFee.Text)) { isFeeMatch = YN.Yes; } } //Check date if (dateFrom == DateTime.MinValue && dateTo == DateTime.MinValue) //No dates entered { isDateMatch = YN.Unknown; } else //At least one date entered { if ((dateFrom.CompareTo(claim.DateService) <= 0 || dateFrom == DateTime.MinValue) && (dateTo.CompareTo(claim.DateService) >= 0 || dateTo == DateTime.MinValue)) { isDateMatch = YN.Yes; } } if ((isFeeMatch == YN.Yes || isDateMatch == YN.Yes) && (isFeeMatch != YN.No && isDateMatch != YN.No)) //If either match and neither don't match //Highlight row { gridClaims.Rows[i].ColorText = Color.Red; gridClaims.Rows[i].Bold = true; rowsHighlightCount++; lastHighlightIndex = i; } } gridClaims.EndUpdate(); if (rowsHighlightCount == 1) { gridClaims.SetSelected(lastHighlightIndex, true); FillClaimDetails(lastHighlightIndex); } }
private void FillGrid() { ODProgress.ShowAction( () => { RefreshReport(); gridMain.BeginUpdate(); if (gridMain.ListGridColumns.Count == 0) { gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Patient"), _colWidthPatName, GridSortingStrategy.StringCompare)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Date"), _colWidthProcDate, HorizontalAlignment.Center, GridSortingStrategy.DateParse)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Code"), _colWidthProcCode, GridSortingStrategy.StringCompare)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Tth"), _colWidthProcTth, GridSortingStrategy.StringCompare)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Prov"), _colWidthProv, GridSortingStrategy.StringCompare)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Fee"), _colWidthFee, HorizontalAlignment.Right, GridSortingStrategy.AmountParse)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Ins Paid"), _colWidthInsPay, HorizontalAlignment.Right, GridSortingStrategy.AmountParse)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Write-off"), _colWidthWO, HorizontalAlignment.Right, GridSortingStrategy.AmountParse)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Pt Paid"), _colWidthPtPaid, HorizontalAlignment.Right, GridSortingStrategy.AmountParse)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Adjust"), _colWidthAdj, HorizontalAlignment.Right, GridSortingStrategy.AmountParse)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Overpayment"), _colWidthOverpay, HorizontalAlignment.Right, GridSortingStrategy.AmountParse)); } gridMain.ListGridRows.Clear(); GridRow row; for (int i = 0; i < _myReport.ReportObjects.Count; i++) { if (_myReport.ReportObjects[i].ObjectType != ReportObjectType.QueryObject) { continue; } QueryObject queryObj = (QueryObject)_myReport.ReportObjects[i]; for (int j = 0; j < queryObj.ReportTable.Rows.Count; j++) { DataRow rowCur = queryObj.ReportTable.Rows[j]; row = new GridRow(); row.Cells.Add(rowCur["patientName"].ToString()); row.Cells.Add(PIn.Date(rowCur["ProcDate"].ToString()).ToShortDateString()); row.Cells.Add(PIn.String(rowCur["ProcCode"].ToString())); row.Cells.Add(PIn.String(rowCur["ToothNum"].ToString())); row.Cells.Add(PIn.String(rowCur["Abbr"].ToString())); row.Cells.Add(PIn.Double(rowCur["fee"].ToString()).ToString("c")); row.Cells.Add(PIn.Double(rowCur["insPaid"].ToString()).ToString("c")); row.Cells.Add(PIn.Double(rowCur["wo"].ToString()).ToString("c")); row.Cells.Add(PIn.Double(rowCur["ptPaid"].ToString()).ToString("c")); row.Cells.Add(PIn.Double(rowCur["adjAmt"].ToString()).ToString("c")); row.Cells.Add(PIn.Double(rowCur["overpay"].ToString()).ToString("c")); row.Tag = rowCur; gridMain.ListGridRows.Add(row); } } gridMain.EndUpdate(); }, startingMessage: "Refreshing Grid...", actionException: e => this.Invoke(() => { FriendlyException.Show(Lan.g(this, "Error filling the Procedures Overpaid grid."), e); }) ); }
private void textEnd_TextChanged(object sender, EventArgs e) { if (textStart.errorProvider1.GetError(textStart) != "" || textEnd.errorProvider1.GetError(textEnd) != "" ) { return; } textTarget.Text = (PIn.Double(textEnd.Text) - PIn.Double(textStart.Text)).ToString("n"); }