<th>Supplier Name</th> <th>Supplier Code</th> <th>approved_kgs</th> <th>supplied_kgs</th> <th>units</th> <th>Date</th> </tr> </thead> <tbody> <?php if (!$view->count()) { echo 'No user'; } else { foreach ($view->results() as $tag) { $code = $tag->supplier_code; $vri = $supplier->search('supplier_code', $code, 'f_name'); //search suppliers name $vrii = $supplier->search('supplier_code', $code, 'l_name'); $k = $vrii . " " . $vri; echo "<tr>"; echo "<td>" . $k . "</td>"; //echo "<td>".$vri."</td>"; echo "<td>" . $tag->supplier_code . "</td>"; echo "<td>" . $tag->approved_kgs . "</td>"; echo "<td>" . $tag->supplied_kgs . "</td>"; echo "<td>" . $tag->units . "</td>"; echo "<td>" . $tag->date . "</td>"; echo "</tr>"; } } ?>
$supplier_code = $_POST["search"]; $name = DB::getInstance()->get('suppliers', array('supplier_code', '=', $_POST["search"])); if (!$name->count()) { echo "<span class='status-not-available'> No supplier.</span>"; } else { $code = $_POST["search"]; } $arr = $dailysupply->myTotalSupplyOf6Months($supplier_code); $todaydate = date('Y-m-d'); $todaydate = substr($todaydate, 5, 7); // 2015-11-11 $datemonth = date('Y-m-d'); $datemonth = substr($datemonth, 0, 8); $datemonth = $datemonth . "01"; //2015-11-02 $sup_name = $supplier->search('supplier_code', $supplier_code, 'f_name') . " " . $supplier->search('supplier_code', $supplier_code, 'l_name'); $aprate = $update->search('settings', 'date', $datemonth, 'approx_rate'); $thismonthkgs = DB::getInstance()->Getsum('approved_kgs', 'daily_supply', $supplier_code); echo ' <dl class="dl-horizontal example1"> <p>Supplier details<p> <dt>Code: </dt> <dd>' . $supplier_code . '</dd> <dt>Name: </dt> <dd>' . $sup_name . '</dd> <dt>NIC NO: </dt> <dd>' . $supplier->search('supplier_code', $supplier_code, 'nic_no') . '</dd> <dt>Approximate tea Rate: </dt> <dd>Rs ' . $aprate . '</dd> <dt>Supply kgs: </dt> <dd>' . $thismonthkgs . ' Kg</dd>
<div class="box box-primary"> <div class="box-header with-border"> <div class="form-group"> <div class="box-tools pull-right"> <a href="message.php"><button class="btn btn-default btn-sm"><i class="fa fa-refresh"></i></button></a> </div> <label>Message Area</label> <?php if (isset($_GET['id'])) { $code = $_GET['id']; $msginfo = DB::getInstance()->get('message_temp', array('message_id', '=', $code)); if (!$msginfo->count()) { echo 'There is no message...!'; } else { foreach ($msginfo->results() as $info) { $vri = $supplier->search('supplier_code', $info->supplier_code, 'f_name'); $vrii = $supplier->search('supplier_code', $info->supplier_code, 'l_name'); $txt = $vrii . " " . $vri; $type = $info->message_code; $reqtype = $supplier->msgtype('message_code', $type, 'request'); ?> <div class="box-body"> <dl class="dl-horizontal example1"> <p>Request message <p> <dt>Supplier Code: </dt> <dd><?php echo $info->supplier_code; ?> </dd> <dt>Supplier Name: </dt>
echo "<div style=\"font-size:15px;\"><a href=\"{$link}\" target=\"_blank\">{$link}</a></div> "; } echo "</div></li>"; echo "<br><li> <div style=\"font-size:20px;\">Item Copies</div></li></ul></div>"; if (count($copies) > 0) { echo "<ul>"; foreach ($copies as $itemCopy) { //collecting item copy details $itemCopyId = $itemCopy->get_id(); $itemCopyOwner = $itemCopy->get_owner(); $itemCopyStatus = $itemCopy->get_status(); $itemCopyBarcode = $itemCopy->get_barcode(); $itemCopyPrice = $itemCopy->get_price(); $itemCopyInstalledDate = $itemCopy->get_installed_date(); $itemCopyCondition = $itemCopy->get_condition(); $itemCopyNo = $itemCopy->get_no(); $itemCopySupplier = $itemCopy->get_supplier(); //collecting item copy supplier details $supplier = Supplier::search(array("supplier_id" => $itemCopySupplier)); $supplierName = $supplier->getCompany(); $supplierName = str_replace(" ", "%19", $supplierName); $supplierEmail = $supplier->getEmail(); echo "<div style=\"float:left;\"><li onclick = itemCopyClicked(\"{$itemCopyId}\",\"{$itemCopyOwner}\",\"{$itemCopyStatus}\",\"{$itemCopyBarcode}\",\"{$itemCopyPrice}\",\"{$itemCopyInstalledDate}\",\"{$itemCopySupplier}\",\"{$supplierName}\",\"{$supplierEmail}\",\"{$itemCopyNo}\");><a class=\"changeBlue\">{$itemCopyNo} </a></li></div><div style=\"font-size:16px; cursor:pointer;\"><font color=\"red\"> (<a onclick=itemCopyDelete(\"{$itemCopyId}\"); >Remove</a>) </font></div>"; } echo "</ul>"; } else { echo "<div style=\"font-family: Georgia, serif;font-size:15px;\">No item copies for this item.<div>"; } //echo "<button type=\"button\" onclick=\"location.href = 'item_copy_add.php?item_id=$item_id&item_name=$itemName';\">Add Item Copy</button>"; //$ItemNameReplaced = str_replace(" ","%19",$itemName); //echo "<button type=\"button\" onclick=AddItemCopyClicked(\"$item_id\",\"$ItemNameReplaced\")>Add Item Copy</button>";
public function actionSearch() { $model = new Supplier('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Supplier'])) { $model->attributes = $_GET['Supplier']; } $criteria = new CDbCriteria(); $criteria->select = 'id,name,lattitude,longitude'; $Suppliers = $model->search(false)->getData(); //Build supplier array and supplier items in a format suitable for Mustache js $supplierArray = SnapUtil::makeArray($Suppliers); foreach ($Suppliers as $Supplier) { $supplierItems = SnapUtil::makeArray($Supplier->SupplierProducts); foreach ($supplierItems as $gi) { $supplierArray[$Supplier->id]['SupplierProducts'][] = $gi; } $supplierArray[$Supplier->id]['has_items'] = !empty($supplierArray[$Supplier->id]['SupplierProducts']) ? true : false; } echo json_encode($supplierArray); exit; }
<?php require_once 'core/init.php'; if (array_key_exists('links', $_POST)) { $tel = $_POST['links']; } else { $tel = array(); } $supplier_data = array("company" => $_POST["company"], "email" => $_POST["email"], "street" => $_POST["street"], "line2" => $_POST["line2"], "city" => $_POST["city"], "province" => $_POST["province"], "postal" => $_POST["postal"], "country" => $_POST["country"], "telephone" => $tel); //print_r($tel); $supplier = Supplier::search(array("supplier_id" => $_POST["supId"])); if ($supplier->update($supplier_data)) { $message = "You have successfully Updated the Supplier !!"; //$response=array("message" => $message); echo $message; } else { $message = "The Supplier Registration was unsuccessful."; //$response=array("message" => $message); echo $message; }
/** * @brief Import Parts (create Parts, and if neccessary, Categories, Footprints and so on) * * @note This function uses database transactions. If an error occurs, all changes will be rolled back. * * @param Database &$database reference to the database object * @param User &$current_user reference to the user which is logged in * @param Log &$log reference to the Log-object * @param array $data The import data array from "extract_import_data_from_request()" * @param boolean $only_check_data If true, this function will only check if all values in "$data" are valid. * In this case, no parts will be imported! * * @retval array All new Part objects (only if "$only_check_data == false") * * @throws Exception if there was an error (maybe the passed data is not valid) */ function import_parts(&$database, &$current_user, &$log, $data, $only_check_data = false) { $parts = array(); try { $transaction_id = $database->begin_transaction(); // start transaction // Get the category, footprint, storelocation, ... which are named "Import", or create them. // We need this elements as parent for new elements, which will be created while import parts. $import_categories = Category::search($database, $current_user, $log, 'Import', true); if (count($import_categories) > 0) { $import_category = $import_categories[0]; $import_category_created = false; } else { $import_category = Category::add($database, $current_user, $log, 'Import', NULL); $import_category_created = true; // we can delete it later if we didn't need it } $import_storelocations = Storelocation::search($database, $current_user, $log, 'Import', true); if (count($import_storelocations) > 0) { $import_storelocation = $import_storelocations[0]; $import_storelocation_created = false; } else { $import_storelocation = Storelocation::add($database, $current_user, $log, 'Import', NULL); $import_storelocation_created = true; // we can delete it later if we didn't need it } $import_footprints = Footprint::search($database, $current_user, $log, 'Import', true); if (count($import_footprints) > 0) { $import_footprint = $import_footprints[0]; $import_footprint_created = false; } else { $import_footprint = Footprint::add($database, $current_user, $log, 'Import', NULL); $import_footprint_created = true; // we can delete it later if we didn't need it } $import_suppliers = Supplier::search($database, $current_user, $log, 'Import', true); if (count($import_suppliers) > 0) { $import_supplier = $import_suppliers[0]; $import_supplier_created = false; } else { $import_supplier = Supplier::add($database, $current_user, $log, 'Import', NULL); $import_supplier_created = true; // we can delete it later if we didn't need it } $import_manufacturers = Manufacturer::search($database, $current_user, $log, 'Import', true); if (count($import_manufacturers) > 0) { $import_manufacturer = $import_manufacturers[0]; $import_manufacturer_created = false; } else { $import_manufacturer = Manufacturer::add($database, $current_user, $log, 'Import', NULL); $import_manufacturer_created = true; // we can delete it later if we didn't need it } $import_category_used = false; $import_storelocation_used = false; $import_footprint_used = false; $import_supplier_used = false; $import_manufacturer_used = false; // start import $row_index = 0; foreach ($data as $row) { $name = $row['part_name']; $description = $row['part_description']; $instock = $row['part_instock']; $mininstock = $row['part_mininstock']; $comment = $row['part_comment']; $category_name = $row['part_category_name']; $footprint_name = $row['part_footprint_name']; $storelocation_name = $row['part_storelocation_name']; $manufacturer_name = $row['part_manufacturer_name']; $supplier_name = $row['part_supplier_name']; $supplierpartnr = $row['part_supplierpartnr']; $price = $row['part_price']; // search elements / create them if they don't exist already if (strlen($category_name) > 0) { $categories = Category::search($database, $current_user, $log, $category_name, true); if (count($categories) > 0) { $category = $categories[0]; } else { $category = Category::add($database, $current_user, $log, $category_name, $import_category->get_id()); $import_category_used = true; } } else { throw new Exception('Jedes Bauteil muss eine Kategorie haben!'); } if (strlen($storelocation_name) > 0) { $storelocations = Storelocation::search($database, $current_user, $log, $storelocation_name, true); if (count($storelocations) > 0) { $storelocation = $storelocations[0]; } else { $storelocation = Storelocation::add($database, $current_user, $log, $storelocation_name, $import_storelocation->get_id()); $import_storelocation_used = true; } } if (strlen($manufacturer_name) > 0) { $manufacturers = Manufacturer::search($database, $current_user, $log, $manufacturer_name, true); if (count($manufacturers) > 0) { $manufacturer = $manufacturers[0]; } else { $manufacturer = Manufacturer::add($database, $current_user, $log, $manufacturer_name, $import_manufacturer->get_id()); $import_manufacturer_used = true; } } if (strlen($footprint_name) > 0) { $footprints = Footprint::search($database, $current_user, $log, $footprint_name, true); if (count($footprints) > 0) { $footprint = $footprints[0]; } else { $footprint = Footprint::add($database, $current_user, $log, $footprint_name, $import_footprint->get_id()); $import_footprint_used = true; } } if (strlen($supplier_name) > 0) { $suppliers = Supplier::search($database, $current_user, $log, $supplier_name, true); if (count($suppliers) > 0) { $supplier = $suppliers[0]; } else { $supplier = Supplier::add($database, $current_user, $log, $supplier_name, $import_supplier->get_id()); $import_supplier_used = true; } } else { if (strlen($supplierpartnr) > 0 || $price > 0) { throw new Exception('Ist eine Bestellnummer oder ein Preis angegeben, so muss auch ein Lieferant angegeben werden!'); } } $new_part = Part::add($database, $current_user, $log, $name, $category->get_id(), $description, $instock, $mininstock, isset($storelocation) ? $storelocation->get_id() : NULL, isset($manufacturer) ? $manufacturer->get_id() : NULL, isset($footprint) ? $footprint->get_id() : NULL, $comment); if (isset($supplier)) { $new_orderdetails = Orderdetails::add($database, $current_user, $log, $new_part->get_id(), $supplier->get_id(), $supplierpartnr); if ($price > 0) { $new_pricedetails = Pricedetails::add($database, $current_user, $log, $new_orderdetails->get_id(), $price); } } if (!$only_check_data) { $parts[] = $new_part; } $row_index++; } // delete all elements which were created in this function, but were not used if ($import_category_created && !$import_category_used) { $import_category->delete(); } if ($import_storelocation_created && !$import_storelocation_used) { $import_storelocation->delete(); } if ($import_footprint_created && !$import_footprint_used) { $import_footprint->delete(); } if ($import_supplier_created && !$import_supplier_used) { $import_supplier->delete(); } if ($import_manufacturer_created && !$import_manufacturer_used) { $import_manufacturer->delete(); } if ($only_check_data) { $database->rollback(); } else { $database->commit($transaction_id); } // commit transaction } catch (Exception $e) { $database->rollback(); // rollback transaction throw new Exception((isset($row_index) ? 'Nr. ' . ($row_index + 1) . ': ' : '') . $e->getMessage()); } return $parts; }
<?php require_once 'core/init.php'; $member_role = $_SESSION['roles']; if (in_array("Laboratory Administrator", $member_role)) { } else { header('location:restricted_page.php'); } $searchValue = $_GET["searchVal"]; $new_supplier = Supplier::search(["supplier_email" => $searchValue]); if ($new_supplier) { echo "<div>"; echo "<fieldset>"; echo "<legend>Supplier Details</legend>"; echo "<div style='display:inline-block'>"; echo "<div style='display:inline-block;vertical-align:top'>"; echo "<table style='padding:20px;'>"; echo "<tr><td>Supplier Name :<th><td>" . $new_supplier->getCompany(); echo "<tr><td>Email :<th><td>" . $new_supplier->getEmail() . "<td><tr>"; echo "<tr><td>Address :<th><td>" . $new_supplier->getStreet() . "," . $new_supplier->getLine2() . "," . $new_supplier->getCity() . "." . "<td><tr>"; echo "<tr><td>Province :<th><td>" . $new_supplier->getProvince() . "<td><tr>"; echo "<tr><td>Postal :<th><td>" . $new_supplier->getPostal() . "<td><tr>"; echo "<tr><td>Country :<th><td>" . $new_supplier->getCountry() . "<td><tr>"; echo "<tr><td>Contact Number :<th><td>" . $new_supplier->getTelephone() . "<td><tr>"; echo "</table>"; } else { echo "<h3><font color='red'>No Supplier Found !!</font></h3>"; }
public function actionGeneratePdf() { $this->layout = 'pdf'; $model = new Supplier('search'); if (isset($_GET['Supplier'])) { $model->attributes = $_GET['Supplier']; } // to execute the filters (if is the case) $dataProvider = $model->search(); $dataProvider->pagination = false; $mPDF1 = Yii::app()->ePdf->mpdf(); # You can easily override default constructor's params $mPDF1 = Yii::app()->ePdf->mpdf('', 'A5'); # renderPartial (only 'view' of current controller) $mPDF1->WriteHTML($this->renderPartial('admin', array('model' => $model), true)); # Outputs ready PDF $mPDF1->Output(); }