private void butPrintClassic() { if(StmtCur.DocNum!=0 && checkIsSent.Checked && !StmtCur.IsInvoice)//Invoices are always recreated on the fly in order to show "Copy" when needed. { //launch existing archive pdf. User can click print from within Acrobat. Cursor=Cursors.WaitCursor; Patient pat=Patients.GetPat(StmtCur.PatNum); string patFolder=ImageStore.GetPatientFolder(pat,ImageStore.GetPreferredAtoZpath()); Process.Start(ImageStore.GetFilePath(Documents.GetByNum(StmtCur.DocNum),patFolder)); Cursor=Cursors.Default; } else {//was not initially sent, or else user has unchecked the sent box if(initiallySent && checkIsSent.Checked && StmtCur.DocNum==0 && !StmtCur.IsInvoice)//for invoice, we don't notify user that it's a recreation { MsgBox.Show(this,"There was no archived image of this statement. The printout will be based on current data."); } //So create an archive if(listMode.SelectedIndex==(int)StatementMode.Email) { listMode.SelectedIndex=(int)StatementMode.InPerson; } checkIsSent.Checked=true; Cursor=Cursors.WaitCursor; if(!SaveToDb()) { Cursor=Cursors.Default; return; } FormRpStatement FormST=new FormRpStatement(); Family fam=Patients.GetFamily(StmtCur.PatNum); Patient pat=fam.GetPatient(StmtCur.PatNum); DataSet dataSet=AccountModules.GetStatementDataSet(StmtCur); FormST.CreateStatementPdfClassic(StmtCur,pat,fam,dataSet); #if DEBUG FormST.PrintStatement(StmtCur,true,dataSet,fam,pat); FormST.ShowDialog(); #else FormST.PrintStatement(StmtCur,false,dataSet,fam,pat); #endif if(StmtCur.IsInvoice && checkIsInvoiceCopy.Visible) {//for foreign countries StmtCur.IsInvoiceCopy=true; Statements.Update(StmtCur); } Cursor=Cursors.Default; } DialogResult=DialogResult.OK; }
private void butPrint_Click(object sender,EventArgs e) { if(StmtCur.DocNum!=0 && checkIsSent.Checked){ //launch existing archive pdf. User can click print from within Acrobat. Cursor=Cursors.WaitCursor; Patient pat=Patients.GetPat(StmtCur.PatNum); string patFolder=ImageStore.GetPatientFolder(pat,ImageStore.GetPreferredAtoZpath()); Process.Start(ImageStore.GetFilePath(Documents.GetByNum(StmtCur.DocNum),patFolder)); Cursor=Cursors.Default; } else{//was not initially sent, or else user has unchecked the sent box if(initiallySent && checkIsSent.Checked && StmtCur.DocNum==0){ MsgBox.Show(this,"There was no archived image of this statement. The printout will be based on current data."); } //So create an archive if(listMode.SelectedIndex==(int)StatementMode.Email){ listMode.SelectedIndex=(int)StatementMode.InPerson; } checkIsSent.Checked=true; Cursor=Cursors.WaitCursor; if(!SaveToDb()){ Cursor=Cursors.Default; return; } FormRpStatement FormST=new FormRpStatement(); Family fam=Patients.GetFamily(StmtCur.PatNum); Patient pat=fam.GetPatient(StmtCur.PatNum); DataSet dataSet=AccountModules.GetStatementDataSet(StmtCur); FormST.CreateStatementPdf(StmtCur,pat,fam,dataSet); #if DEBUG FormST.PrintStatement(StmtCur,true,dataSet,fam,pat); FormST.ShowDialog(); #else FormST.PrintStatement(StmtCur,false,dataSet,fam,pat); #endif Cursor=Cursors.Default; } DialogResult=DialogResult.OK; }
private void butPreviewClassic() { if(StmtCur.DocNum!=0 && checkIsSent.Checked) {//initiallySent && checkIsSent.Checked){ //launch existing archive pdf Cursor=Cursors.WaitCursor; Patient pat=Patients.GetPat(StmtCur.PatNum); string patFolder=ImageStore.GetPatientFolder(pat,ImageStore.GetPreferredAtoZpath()); //Currently unable to load Statements stored in database even though they get saved into the database. if(!File.Exists(ImageStore.GetFilePath(Documents.GetByNum(StmtCur.DocNum),patFolder))) { Cursor=Cursors.Default; MsgBox.Show(this,"File not found: " + Documents.GetByNum(StmtCur.DocNum).FileName); return; } Process.Start(ImageStore.GetFilePath(Documents.GetByNum(StmtCur.DocNum),patFolder)); Cursor=Cursors.Default; } else{//was not initially sent, or else user has unchecked the sent box //No archive to use, so just preview on the fly if(initiallySent && checkIsSent.Checked && StmtCur.DocNum==0){ MsgBox.Show(this,"There was no archived image of this statement. The preview will be based on current data."); } Cursor=Cursors.WaitCursor; if(!SaveToDb()){ Cursor=Cursors.Default; return; } FormRpStatement FormST=new FormRpStatement(); Family fam=Patients.GetFamily(StmtCur.PatNum); Patient pat=fam.GetPatient(StmtCur.PatNum); DataSet dataSet=AccountModules.GetStatementDataSet(StmtCur); //Would throw exception if no printer is installed. try { FormST.PrintStatement(StmtCur,true,dataSet,fam,pat); } catch { MsgBox.Show(this,"No printers installed."); Cursor=Cursors.Default; return; } FormST.ShowDialog(); Cursor=Cursors.Default; } }
private void butPreview_Click(object sender,EventArgs e) { if(StmtCur.DocNum!=0 && checkIsSent.Checked){//initiallySent && checkIsSent.Checked){ //launch existing archive pdf Cursor=Cursors.WaitCursor; Patient pat=Patients.GetPat(StmtCur.PatNum); string patFolder=ImageStore.GetPatientFolder(pat,ImageStore.GetPreferredAtoZpath()); Process.Start(ImageStore.GetFilePath(Documents.GetByNum(StmtCur.DocNum),patFolder)); Cursor=Cursors.Default; } else{//was not initially sent, or else user has unchecked the sent box //No archive to use, so just preview on the fly if(initiallySent && checkIsSent.Checked && StmtCur.DocNum==0){ MsgBox.Show(this,"There was no archived image of this statement. The preview will be based on current data."); } Cursor=Cursors.WaitCursor; if(!SaveToDb()){ Cursor=Cursors.Default; return; } FormRpStatement FormST=new FormRpStatement(); Family fam=Patients.GetFamily(StmtCur.PatNum); Patient pat=fam.GetPatient(StmtCur.PatNum); DataSet dataSet=AccountModules.GetStatementDataSet(StmtCur); FormST.PrintStatement(StmtCur,true,dataSet,fam,pat); FormST.ShowDialog(); Cursor=Cursors.Default; } }