Ejemplo n.º 1
0
Archivo: batch.php Proyecto: alcf/chms
 protected function Form_Create()
 {
     $this->objBatch = PaypalBatch::Load(QApplication::PathInfo(0));
     if (!$this->objBatch) {
         QApplication::Redirect('/stewardship/paypal');
     }
     $this->strPageTitle .= $this->objBatch->Number;
     $this->dtgTransactions = new QDataGrid($this);
     $this->dtgTransactions->SetDataBinder('dtgTransactions_Bind');
     $this->dtgTransactions->AddColumn(new QDataGridColumn('Date Captured', '<?= $_ITEM[0]; ?>', 'Width=150px', 'HtmlEntities=false', 'VerticalAlign=top'));
     $this->dtgTransactions->AddColumn(new QDataGridColumn('Total Amount Charged', '<?= $_ITEM[1]; ?>', 'Width=150px', 'VerticalAlign=top'));
     $this->dtgTransactions->AddColumn(new QDataGridColumn('Transaction Code', '<?= $_ITEM[2]; ?>', 'Width=120px', 'VerticalAlign=top'));
     $this->dtgTransactions->AddColumn(new QDataGridColumn('Account Funding', '<?= $_ITEM[3]; ?>', 'Width=330px', 'HtmlEntities=false', 'VerticalAlign=top', 'FontSize=10px'));
     $this->dtgTransactions->AddColumn(new QDataGridColumn('Funding Amount', '<?= $_ITEM[4]; ?>', 'Width=150px', 'HtmlEntities=false', 'VerticalAlign=top', 'FontSize=10px'));
     $this->dtgFunding = new QDataGrid($this);
     $this->dtgFunding->SetDataBinder('dtgFunding_Bind');
     $this->dtgFunding->AddColumn(new QDataGridColumn('Fund', '<?= $_ITEM[0]; ?>', 'Width=340px', 'HtmlEntities=false'));
     $this->dtgFunding->AddColumn(new QDataGridColumn('Account Number', '<?= $_ITEM[1]; ?>', 'Width=200px'));
     $this->dtgFunding->AddColumn(new QDataGridColumn('Amount', '<?= $_ITEM[2]; ?>', 'HtmlEntities=false', 'Width=380px', 'HtmlEntities=false'));
     $this->dtgUnaccounted = new CreditCardPaymentDataGrid($this);
     $this->dtgUnaccounted->MetaAddColumn('DateCaptured', 'Width=200px');
     $this->dtgUnaccounted->MetaAddColumn('AmountCharged', 'Html=<?= QApplication::DisplayCurrency($_ITEM->AmountCharged); ?>', 'Width=150px');
     $this->dtgUnaccounted->MetaAddColumn('TransactionCode', 'Width=500px');
     $this->dtgUnaccounted->SortColumnIndex = 0;
     $this->dtgUnaccounted->SetDataBinder('dtgUnaccounted_Bind');
     $this->dtgUnaccounted->NoDataHtml = 'Good!  There are no unaccounted-for credit card transaction entries in this PayPal batch.';
     $this->pxyEditFundDonationLineItem = new QControlProxy($this);
     $this->pxyEditFundDonationLineItem->AddAction(new QClickEvent(), new QAjaxAction('pxyEditFundDonationLineItem_Click'));
     $this->pxyEditFundDonationLineItem->AddAction(new QClickEvent(), new QTerminateAction());
     $this->pxyEditFundSignupPayment = new QControlProxy($this);
     $this->pxyEditFundSignupPayment->AddAction(new QClickEvent(), new QAjaxAction('pxyEditFundSignupPayment_Click'));
     $this->pxyEditFundSignupPayment->AddAction(new QClickEvent(), new QTerminateAction());
     $this->lblInstructionHtml = new QLabel($this);
     $this->lblInstructionHtml->TagName = 'p';
     $this->lblInstructionHtml->HtmlEntities = false;
     $this->dtxDateCredited = new QDateTimeTextBox($this);
     $this->dtxDateCredited->Name = 'Date to Credit Stewardship Contributions';
     $this->dtxDateCredited->Text = QDateTime::NowToString('MMMM D YYYY');
     $this->dtxDateCredited->Required = true;
     $this->btnPost = new QButton($this);
     $this->btnPost->Text = 'Post to NOAH';
     $this->btnPost->CssClass = 'primary';
     $this->btnPost->CausesValidation = $this->dtxDateCredited;
     $this->btnSplit = new QButton($this);
     $this->btnSplit->Text = 'Split This Batch';
     $this->btnSplit->CssClass = 'alternate';
     $this->btnSplit->SetCustomStyle('float', 'right');
     $this->btnSplit->AddAction(new QClickEvent(), new QAjaxAction('btnSplit_Click'));
     $this->dlgEditFund = new QDialogBox($this);
     $this->dlgEditFund->MatteClickable = false;
     $this->dlgEditFund->HideDialogBox();
     $this->dlgEditFund->Template = dirname(__FILE__) . '/dlgEditFund.tpl.php';
     $this->lblDialogFund = new QLabel($this->dlgEditFund);
     $this->lblDialogFund->Text = 'Please specify the appropriate Stewardship Funding Account for this line item.';
     $this->lblDialogFund->Visible = false;
     $this->lstDialogFund = new QListBox($this->dlgEditFund);
     $this->lstDialogFund->Name = 'Stewardship Fund';
     $this->lstDialogFund->AddItem('- Select One -', null);
     $this->lstDialogFund->Required = true;
     foreach (StewardshipFund::LoadArrayByActiveFlag(true, QQ::OrderBy(QQN::StewardshipFund()->Name)) as $objFund) {
         $this->lstDialogFund->AddItem($objFund->Name, $objFund->Id);
     }
     $this->lstDialogFund->AddItem('- Other (Non-Donation)... -', -1);
     $this->lstDialogFund->AddAction(new QChangeEvent(), new QAjaxAction('lstDialogFund_Change'));
     $this->lstDialogFund->Visible = false;
     $this->txtDialogOther = new QTextBox($this->dlgEditFund);
     $this->txtDialogOther->Name = 'Non-Donation Funding Account';
     $this->txtDialogOther->Visible = false;
     $this->lblDialogSplitFund = new QLabel($this->dlgEditFund);
     $this->lblDialogSplitFund->Visible = false;
     $this->lstDialogSplitFund = array();
     $this->txtDialogSplitOther = array();
     $this->txtDialogSplitAmount = array();
     $this->lblDialogSplitFundTitle = array();
     for ($i = 0; $i < 2; $i++) {
         $this->lblDialogSplitFundTitle[$i] = new QLabel($this->dlgEditFund);
         $this->lblDialogSplitFundTitle[$i]->HtmlEntities = false;
         $this->lblDialogSplitFundTitle[$i]->Text = '<h4>Line Item ' . ($i + 1) . '</h4>';
         $this->lblDialogSplitFundTitle[$i]->Visible = false;
         $this->lstDialogSplitFund[$i] = new QListBox($this->dlgEditFund);
         $this->lstDialogSplitFund[$i]->Name = 'Stewardship Fund';
         $this->lstDialogSplitFund[$i]->AddItem('- Select One -', null);
         $this->lstDialogSplitFund[$i]->Required = true;
         foreach (StewardshipFund::LoadArrayByActiveFlag(true, QQ::OrderBy(QQN::StewardshipFund()->Name)) as $objFund) {
             $this->lstDialogSplitFund[$i]->AddItem($objFund->Name, $objFund->Id);
         }
         $this->lstDialogSplitFund[$i]->AddItem('- Other (Non-Donation)... -', -1);
         $this->lstDialogSplitFund[$i]->ActionParameter = $i;
         $this->lstDialogSplitFund[$i]->AddAction(new QChangeEvent(), new QAjaxAction('lstDialogSplitFund_Change'));
         $this->lstDialogSplitFund[$i]->Visible = false;
         $this->txtDialogSplitOther[$i] = new QTextBox($this->dlgEditFund);
         $this->txtDialogSplitOther[$i]->Name = 'Non-Donation Funding Account';
         $this->txtDialogSplitOther[$i]->Visible = false;
         $this->txtDialogSplitAmount[$i] = new QFloatTextBox($this->dlgEditFund);
         $this->txtDialogSplitAmount[$i]->Name = 'Funding Amount';
         $this->txtDialogSplitAmount[$i]->Visible = false;
     }
     $this->rbtnUpdateFundSelection = new QRadioButtonList($this->dlgEditFund);
     $this->rbtnUpdateFundSelection->AddItem('Change Stewardship Funding Account of the Line Item', 1);
     $this->rbtnUpdateFundSelection->AddItem('Split this Line Item into two separate Funding Accounts', 2);
     $this->rbtnUpdateFundSelection->HtmlBefore = 'Select how you would like to update this Stewardship Fund';
     $this->rbtnUpdateFundSelection->AddAction(new QChangeEvent(), new QAjaxAction('rbtnUpdateFundSelection_Change'));
     $this->btnDialogSave = new QButton($this->dlgEditFund);
     $this->btnDialogSave->CssClass = 'primary';
     $this->btnDialogSave->Text = 'Update';
     $this->btnDialogSave->CausesValidation = QCausesValidation::SiblingsAndChildren;
     $this->btnDialogSave->AddAction(new QClickEvent(), new QAjaxAction('btnDialogSave_Click'));
     $this->btnDialogCancel = new QLinkButton($this->dlgEditFund);
     $this->btnDialogCancel->CssClass = 'cancel';
     $this->btnDialogCancel->Text = 'Cancel';
     $this->btnDialogCancel->AddAction(new QClickEvent(), new QAjaxAction('btnDialogCancel_Click'));
     $this->btnDialogCancel->AddAction(new QClickEvent(), new QTerminateAction());
     $this->dlgSplit = new QDialogBox($this);
     $this->dlgSplit->MatteClickable = false;
     $this->dlgSplit->HideDialogBox();
     $this->dlgSplit->Template = dirname(__FILE__) . '/dlgSplit.tpl.php';
     $this->lstSplitItem = new QListBox($this->dlgSplit);
     $this->lstSplitItem->Name = 'Transaction Split Point';
     $this->lstSplitItem->AddItem('- Select One -', null);
     $this->lstSplitItem->Required = true;
     foreach ($this->objBatch->GetCreditCardPaymentArray(QQ::OrderBy(QQN::CreditCardPayment()->DateCaptured)) as $objPayment) {
         $this->lstSplitItem->AddItem('After ' . $objPayment->DateCaptured->ToString('MMM D YYYY h:mm z'), $objPayment->Id);
     }
     $this->txtSplitNameCurrent = new QTextBox($this->dlgSplit);
     $this->txtSplitNameCurrent->Name = 'Batch Number/Title for Original Batch';
     $this->txtSplitNameCurrent->Text = $this->objBatch->Number . ' (1)';
     $this->txtSplitNameNew = new QTextBox($this->dlgSplit);
     $this->txtSplitNameNew->Name = 'Batch Number/Title for New Batch';
     $this->txtSplitNameNew->Text = $this->objBatch->Number . ' (2)';
     $this->btnSplitSave = new QButton($this->dlgSplit);
     $this->btnSplitSave->CssClass = 'primary';
     $this->btnSplitSave->Text = 'Split';
     $this->btnSplitSave->CausesValidation = QCausesValidation::SiblingsAndChildren;
     $this->btnSplitSave->AddAction(new QClickEvent(), new QAjaxAction('btnSplitSave_Click'));
     $this->btnSplitCancel = new QLinkButton($this->dlgSplit);
     $this->btnSplitCancel->CssClass = 'cancel';
     $this->btnSplitCancel->Text = 'Cancel';
     $this->btnSplitCancel->AddAction(new QClickEvent(), new QAjaxAction('btnSplitCancel_Click'));
     $this->btnSplitCancel->AddAction(new QClickEvent(), new QTerminateAction());
     $this->Transactions_Refresh();
 }