Ejemplo n.º 1
0
 public function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     $objStackArray = array();
     foreach ($this->objBatch->GetStewardshipStackArray() as $objStack) {
         $objStackArray[$objStack->StackNumber] = $objStack;
     }
     $fltTotalAmount = 0;
     foreach ($this->txtReportedTotals as $txtReportedTotal) {
         if ($txtReportedTotal->Visible) {
             $intStackNumber = intval($txtReportedTotal->ActionParameter);
             if ($fltAmount = trim($txtReportedTotal->Text)) {
                 $fltTotalAmount += $fltAmount;
             } else {
                 $fltAmount = null;
             }
             if (array_key_exists($intStackNumber, $objStackArray)) {
                 $objStack = $objStackArray[$intStackNumber];
             } else {
                 $objStack = new StewardshipStack();
                 $objStack->StewardshipBatch = $this->objBatch;
                 $objStack->StackNumber = $intStackNumber;
             }
             $objStack->ReportedTotalAmount = $fltAmount;
             $objStack->Save();
         }
     }
     $this->mctStewardshipBatch->StewardshipBatch->ReportedTotalAmount = $fltTotalAmount;
     $this->mctStewardshipBatch->SaveStewardshipBatch();
     // iterate through Stewardship contributions in the batch and set the date credited
     $objContributionArray = $this->objBatch->GetStewardshipContributionArray();
     foreach ($objContributionArray as $objContribution) {
         $objContribution->DateCredited = $this->calDateCredited->DateTime;
         $objContribution->save();
     }
     $this->objForm->pnlBatchTitle->Refresh();
     $this->objForm->pnlStacks_Refresh();
     return $this->ReturnTo('#1');
 }
Ejemplo n.º 2
0
 /**
  * Creates a new stack for this batch
  * @param float $fltReportedTotalAmount optional
  * @return StewardshipStack
  */
 public function CreateStack($fltReportedTotalAmount = null)
 {
     $objStack = new StewardshipStack();
     $objStack->StewardshipBatch = $this;
     $objStack->StackNumber = $this->CountStewardshipStacks() + 1;
     $objStack->ReportedTotalAmount = $fltReportedTotalAmount;
     $objStack->ActualTotalAmount = 0;
     $objStack->Save();
     return $objStack;
 }