public function renderContent() { $content = AgreementProductUtils::makeCostBookProductSelection($this->data, $this->agmntId); // $content = 'Test'; $content .= $this->renderScripts(); return $content; }
public function makeCostBookProductSelection($datas, $opportunityId) { $content = AgreementProductUtils::appendButton($opportunityId); $content .= '<hr/><div class="cgrid-view type-opportunityProducts" id="list-view"> <div class="summary">5 result(s)</div> <div class="items-wrapper"> <table class="items"> <thead> <tr> <th class="checkbox-column" id="list-view-rowSelector"><label class="hasCheckBox"><input value="1" name="list-view-rowSelector_all" id="list-view-rowSelector_all" type="checkbox"></label></th><th id="list-view_c1">Product Code</th><th id="list-view_c2"><a class="sort-link" href="/app/index.php/opportunityProducts/default/index?OpportunityProduct_sort=name">Product Name</a></th><th id="list-view_c3">Unit of Measure</th> <th id="list-view_c4">Unit Direct Cost</th><th id="list-view_c5">Quantity</th><th id="list-view_c6">Frequency</th><th id="list-view_c7">Category</th> </tr> </thead> <tbody>'; $count = 0; $content1 = ''; foreach ($datas as $data) { $content .= '<tr class="odd"><td class="checkbox-column"><label class="hasCheckBox"><input value="' . $data->id . '" id="list-view-rowSelector_' . $count . '" name="list-view-rowSelector[]" type="checkbox"></label></td><td>' . $data->productcode . '</td><td>' . $data->productkey . '</td><td>' . $data->unitofmeasure . '</td><td>' . $data->unitdirectcost . '</td><td><input type="text" id="quantity_' . $count . '" value="1.0"></td><td><input type="text" id="frequency_' . $count . '" value="1"></td><td>' . $data->category . '</td></tr>'; $count++; } $content .= '</tbody></table><input value="" name="list-view-selectedIds" id="list-view-selectedIds" type="hidden"></div></div>'; return $content; }
public function actionAddAgreementProducts($ids, $data, $optId) { if ($ids != null && $data != null) { $costbookDatas = explode(',', $data); foreach ($costbookDatas as $costbookData) { list($id, $quantity, $frequency) = explode(':', $costbookData); $costbook = Costbook::getById($id); AgreementProductUtils::addAgreementProductsCalculation($costbook, $quantity, $frequency, $optId); } } $this->redirect(array('/agreements/default/details?id=' . $optId)); }