示例#1
0
 $fundIDArray = explode(':::', $_POST['fundIDs']);
 $paymentAmountArray = array();
 $paymentAmountArray = explode(':::', $_POST['paymentAmounts']);
 $currencyCodeArray = array();
 $currencyCodeArray = explode(':::', $_POST['currencyCodes']);
 $orderTypeArray = array();
 $orderTypeArray = explode(':::', $_POST['orderTypes']);
 $costDetailsArray = array();
 $costDetailsArray = explode(':::', $_POST['costDetails']);
 $costNoteArray = array();
 $costNoteArray = explode(':::', $_POST['costNotes']);
 $invoiceArray = array();
 $invoiceArray = explode(':::', $_POST['invoices']);
 foreach ($orderTypeArray as $key => $value) {
     if ($value && ($paymentAmountArray[$key] || $yearArray[$key] || $fundIDArray[$key] || $costNoteArray[$key])) {
         $resourcePayment = new ResourcePayment();
         $resourcePayment->resourceID = $resourceID;
         $resourcePayment->year = $yearArray[$key];
         $start = $subStartArray[$key] ? date("Y-m-d", strtotime($subStartArray[$key])) : null;
         $end = $subEndArray[$key] ? date("Y-m-d", strtotime($subEndArray[$key])) : null;
         $resourcePayment->subscriptionStartDate = $start;
         $resourcePayment->subscriptionEndDate = $end;
         $resourcePayment->fundID = $fundIDArray[$key];
         $resourcePayment->paymentAmount = cost_to_integer($paymentAmountArray[$key]);
         $resourcePayment->currencyCode = $currencyCodeArray[$key];
         $resourcePayment->orderTypeID = $value;
         $resourcePayment->costDetailsID = $costDetailsArray[$key];
         $resourcePayment->costNote = $costNoteArray[$key];
         $resourcePayment->invoiceNum = $invoiceArray[$key];
         try {
             $resourcePayment->save();
    $formWidth = 564;
}
$resourceID = $_GET['resourceID'];
$resource = new Resource(new NamedArguments(array('primaryKey' => $resourceID)));
$orderType = new OrderType(new NamedArguments(array('primaryKey' => $resource->orderTypeID)));
$acquisitionType = new AcquisitionType(new NamedArguments(array('primaryKey' => $resource->acquisitionTypeID)));
//get purchase sites
$sanitizedInstance = array();
$instance = new PurchaseSite();
$purchaseSiteArray = array();
foreach ($resource->getResourcePurchaseSites() as $instance) {
    $purchaseSiteArray[] = $instance->shortName;
}
//get payments
$sanitizedInstance = array();
$instance = new ResourcePayment();
$paymentArray = array();
foreach ($resource->getResourcePayments() as $instance) {
    foreach (array_keys($instance->attributeNames) as $attributeName) {
        $sanitizedInstance[$attributeName] = $instance->{$attributeName};
    }
    $sanitizedInstance[$instance->primaryKeyName] = $instance->primaryKey;
    $selector = new User(new NamedArguments(array('primaryKey' => $instance->selectorLoginID)));
    $sanitizedInstance['selectorName'] = $selector->firstName . " " . $selector->lastName;
    $orderType = new OrderType(new NamedArguments(array('primaryKey' => $instance->orderTypeID)));
    $sanitizedInstance['orderType'] = $orderType->shortName;
    $costDetails = new CostDetails(new NamedArguments(array('primaryKey' => $instance->costDetailsID)));
    $sanitizedInstance['costDetails'] = $costDetails->shortName;
    if ($enhancedCostFlag && 0) {
        $sanitizedInstance['amountChange'] = $instance->getPaymentAmountChangeFromPreviousYear();
    }