function deletesubTopic() { if (isset($_GET['TopicId']) && (int) $_GET['TopicId'] > 0) { $TopicId = (int) $_GET['TopicId']; } else { header('Location: index.php'); } // remove any references to this Topic from // tbl_order_item and tbl_cart $sql = "DELETE FROM tbl_order_item\r\n\t WHERE pd_id = {$TopicId}"; dbQuery($sql); $sql = "DELETE FROM tbl_cart\r\n\t WHERE pd_id = {$TopicId}"; dbQuery($sql); // get the image name and thumbnail $sql = "SELECT pd_image, pd_thumbnail\r\n\t FROM tbl_Topic\r\n\t\t\tWHERE pd_id = {$TopicId}"; $result = dbQuery($sql); $row = dbFetchAssoc($result); // remove the Topic image and thumbnail if ($row['pd_image']) { unlink(SRV_ROOT . 'images/Topic/' . $row['pd_image']); unlink(SRV_ROOT . 'images/Topic/' . $row['pd_thumbnail']); } // remove the Topic from database; $sql = "DELETE FROM tbl_Topic \r\n\t WHERE pd_id = {$TopicId}"; dbQuery($sql); header('Location: index.php?catId=' . $_GET['catId']); }
function getShopConfig() { // get current configuration $sql = "SELECT sc_name, sc_address, sc_phone, sc_email, sc_shipping_cost, sc_order_email, cy_symbol \r\n\t\t\tFROM tbl_shop_config sc, tbl_currency cy\r\n\t\t\tWHERE sc_currency = cy_id"; $result = dbQuery($sql); $row = dbFetchAssoc($result); if ($row) { extract($row); $shopConfig = array('name' => $sc_name, 'address' => $sc_address, 'phone' => $sc_phone, 'email' => $sc_email, 'sendOrderEmail' => $sc_order_email, 'shippingCost' => $sc_shipping_cost, 'currency' => $cy_symbol); } else { $shopConfig = array('name' => '', 'address' => '', 'phone' => '', 'email' => '', 'sendOrderEmail' => '', 'shippingCost' => '', 'currency' => ''); } return $shopConfig; }
function doLogin() { // if we found an error save the error message in this variable $errorMessage = ''; $userName = $_POST['txtUserName']; $password = $_POST['txtPassword']; // $_SESSION['user_id'] = $username; // first, make sure the username & password are not empty if ($userName == '') { $errorMessage = 'You must enter your username'; } else { if ($password == '') { $errorMessage = 'You must enter the password'; } else { // check the database and see if the username and password combo do match $sql = "SELECT user_id,user_name\n\t\t FROM tbl_user \n\t\t\t\tWHERE user_name = '{$userName}' AND user_password = '******'"; $result = dbQuery($sql); if (dbNumRows($result) == 1) { $row = dbFetchAssoc($result); $_SESSION['user_id'] = $row['user_id']; $_SESSION['user_name'] = $row['user_name']; // log the time when the user last login $sql = "UPDATE tbl_user \n\t\t\t SET user_last_login = NOW() \n\t\t\t\t\tWHERE user_id = '{$row['user_id']}'"; dbQuery($sql); // now that the user is verified we move on to the next page // if the user had been in the admin pages before we move to // the last page visited $row = dbFetchAssoc($result); if ($userName == 'admin') { // echo $userName; // echo'1'; header('Location: index.php'); exit; } else { if ($row['user_level'] == 0) { // echo $userName; // echo'2'; header("Location: http://localhost/html/main.php"); exit; } } } else { $errorMessage = 'Wrong username or password'; } } } return $errorMessage; }
function getProductDetail($pdId, $catId) { $_SESSION['shoppingReturnUrl'] = $_SERVER['REQUEST_URI']; // get the product information from database $sql = "SELECT pd_name, pd_description, pd_price, pd_image, pd_qty\n\t\t\tFROM tbl_product\n\t\t\tWHERE pd_id = {$pdId}"; $result = dbQuery($sql); $row = dbFetchAssoc($result); extract($row); $row['pd_description'] = nl2br($row['pd_description']); if ($row['pd_image']) { $row['pd_image'] = WEB_ROOT . 'images/product/' . $row['pd_image']; } else { $row['pd_image'] = WEB_ROOT . 'images/no-image-large.png'; } $row['cart_url'] = "cart.php?action=add&p={$pdId}"; return $row; }
function doLogin() { $errorMessage = ''; $accno = (int) $_POST['accno']; $pwd = $_POST['pass']; $sql = "SELECT u.fname, u.lname, u.email, u.is_active, u.pics, u.phone,\n\t\t\ta.acc_no, a.user_id, a.pin, a.type, a.status,\n\t\t\tad.address, ad.city, ad.state, ad.zipcode\n\t\t\tFROM tbl_users u, tbl_accounts a, tbl_address ad\n\t\t\tWHERE a.acc_no = {$accno} AND u.pwd = PASSWORD('{$pwd}')\n\t\t\tAND u.id = a.user_id AND ad.user_id = u.id AND u.is_active != 'FALSE'"; $result = dbQuery($sql); if (dbNumRows($result) == 1) { $row = dbFetchAssoc($result); $_SESSION['hlbank_tmp'] = $row; $_SESSION['hlbank_user_name'] = strtoupper($row['fname'] . ' ' . $row['lname']); header('Location: pin.php'); exit; } else { $errorMessage = 'Your account number or password incorrect or Account is not Active.'; } return $errorMessage; }
?> > <span class="oneline" <?php if ($subtopicid == $subt_id) { ?> style="font-weight: bold"<?php } ?> > <font size="1.5" face="verdana" > <?php echo $name; ?> </font></span></a> <?php while ($row1 = dbFetchAssoc($result1)) { extract($row1); $surl = "index.php?&c=" . encrypt($course) . "&su=" . encrypt($subuniversity) . "&st=" . encrypt($subt_id); $subtopic_storage[$subt_id] = array('name' => $name, 'subt_id' => $subt_id, 'url' => $surl, 'next' => ''); if ($flag != 0) { $subtopic_storage[$flag]['next'] = $subt_id; $flag = 0; } if ($subtopicid == $subt_id) { $flag = $subt_id; } ?> <a class="subtopics lefttitle" title="<?php echo $name; ?>
function _deleteImage($catId) { // we will return the status // whether the image deleted successfully $deleted = false; // get the image(s) $sql = "SELECT cat_image \n FROM tbl_category\n WHERE cat_id "; if (is_array($catId)) { $sql .= " IN (" . implode(',', $catId) . ")"; } else { $sql .= " = {$catId}"; } $result = dbQuery($sql); if (dbNumRows($result)) { while ($row = dbFetchAssoc($result)) { // delete the image file $deleted = @unlink(SRV_ROOT . CATEGORY_IMAGE_DIR . $row['cat_image']); } } return $deleted; }
$objReader = PHPExcel_IOFactory::createReader($inputFileType); $objReader->setReadDataOnly(true); $objReader->setLoadSheetsOnly("MERVEN"); $objPHPExcel = $objReader->load($inputFileName); } catch (Exception $e) { die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage()); } /* PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp; $cacheSettings = array( 'memoryCacheSize' => '1024MB'); PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings); */ // Get worksheet dimensions $arts = "SELECT count(id) as cant FROM articulo WHERE active = 1"; $arts1 = dbQuery($arts); $arts2 = dbFetchAssoc($arts1); $sheet = $objPHPExcel->getSheet(0); $highestRow = $sheet->getHighestRow(); $highestColumn = $sheet->getHighestColumn(); PHPExcel_Calculation::getInstance($objPHPExcel)->cyclicFormulaCount = 1; //$objReader->setPreCalculateFormulas(FALSE); $i = 1; //$arts2['cant'] /*while($i < 10){ $value = $objPHPExcel->getSheetByName("MERVEN")->getCell('F'.$i)->getCalculatedValue(); if( $value == 'OBS:'){ break; }else{ $i++; echo ' Valor loco: '. $i.'<br>'; }
$i .= "fecha_modifica = now(), "; $i .= "usuario_id = $usuario_id "; $i .= " WHERE articulo_id = $articulo AND active = 1"; //echo $i; $i1 = dbQuery($i); */ //aqui es salida ya que de la bodega "A" se pasa a la bodega "B" //SAL = SALIDA, MBD = Movimiento Bodegas $di = "INSERT INTO inventario_d ("; $di .= "articulo_id, bodega_id, tipo, cantidad, motivo, bodega_origen_id, bodega_destino_id, fecha_alta, usuario_id )"; $di .= " VALUES ({$articulo}, {$bodega},'SAL',{$cantidad},'MBD', {$bodega},{$bodega_destino},now(),{$usuario_id})"; dbQuery($di); //aqui es entrada ya que la bodega "B" recibe producto de la bodega "A" //SAL = SALIDA, MBD = Movimiento Bodegas $di = "INSERT INTO inventario_d ("; $di .= "articulo_id, bodega_id, tipo, cantidad, motivo, bodega_origen_id, bodega_destino_id, fecha_alta, usuario_id )"; $di .= " VALUES ({$articulo}, {$bodega_destino},'ENT',{$cantidad},'MBD', {$bodega},{$bodega_destino},now(),{$usuario_id})"; dbQuery($di); $r = "exito"; } } else { //INSERT $r = "fracaso"; } $q = "SELECT * FROM inventario WHERE articulo_id = {$articulo} AND active = 1"; $q1 = dbQuery($q); $q2 = dbNumRows($q1); $q3 = dbFetchAssoc($q1); echo $r . '|' . $q3['stock']; break; }
</div> </div> <div class="panel-body"> <div class="row"> <div class="col-sm-12 col-md-12 col-lg-12"> <?php $id = 50; //id pedido $id_cliente = 100; //100 empieza y llega al 1500 for ($i = 0; $i <= 1110; $i++) { $id_cliente = rand(5, 15); $c = "SELECT * FROM cliente WHERE id = {$id_cliente}"; $c1 = dbQuery($c); $c3 = dbFetchAssoc($c1); $nit = $c3['nit']; $nombre_negocio = $c3['nombre_negocio']; $referencia = $c3['refe']; $usuario_vendedor_id = $c3['usuario_vendedor_id']; $w = "INSERT INTO pedido ("; $w .= "id,status, cliente_id ,nit,nombre_negocio,refe,usuario_vendedor_id,transporte,municipio,depto,direccion_entrega, zona,"; $w .= "observacion,fecha_alta,usuario_id,pago,pago_pedido)"; $w .= " VALUES ({$id},1,{$id_cliente},'nit','{$cliente_negocio}','{$referencia}',{$id_usuario_vendedor},'{$transporte_pedido}',"; $w .= "{$municipio},{$depto},'{$direccion_pedido}',{$zona},'{$observaciones_pedido}', "; $w .= "{$seguro_pedido}, {$flete_pedido}, {$guatex_pedido},{$fecha_alta},{$usuario_id},'{$pago_cliente_pedido}','{$pago_pedido}' "; $w .= ")"; } ?> </div>
$nc2 = dbQuery($nc); $nc_count = dbNumRows($nc2); if ($nc_count > 0) { ?> Notas De Credito <table class="table table-condensed " > <thead > <th bgcolor="#DAA520">No.</th> <th bgcolor="#DAA520">Fecha</th> <th bgcolor="#DAA520">Tipo</th> <th bgcolor="#DAA520">Total</th> </thead> <tbody> <?php while ($row = dbFetchAssoc($nc2)) { ?> <tr bgcolor="#FFD700"> <td ><?php echo $row['id']; ?> </td> <td><?php echo $row['fa']; ?> </td> <td><?php echo $row['tipo']; ?> </td> <td class="text-right"><?php
} */ $user = $_POST['inputEmail']; $password = $_POST['inputPassword']; //$pass = crypt_blowfish_bydinvaders($password); //usar esto solo para generar passwords //echo "pass Encriptado: ".$pass; $passwordenBD = ""; $q = "SELECT * FROM usuario WHERE usuario = '{$user}'"; //echo $q; $q1 = dbQuery($q); $q_tot = dbNumRows($q1); if ($q_tot > 0) { $q2 = dbFetchAssoc($q1); $_SESSION['id_user'] = $q2['id']; //variables de sesion $_SESSION['username'] = $q2['usuario']; //variables de sesion $passwordenBD = $q2['password']; if (crypt($password, $passwordenBD) == $passwordenBD) { //echo '<br/>Es igual'; header("Location: modulos.php"); die; } else { //echo '<br/> No es igual'; header("Location: index.php"); die; } //echo "<br/>exito";//si existe el usuario
function _deleteImage($productId) { // we will return the status // whether the image deleted successfully $deleted = false; $sql = "SELECT pd_image, pd_thumbnail \n\t FROM tbl_product\n\t\t\tWHERE pd_id = {$productId}"; $result = dbQuery($sql) or die('Cannot delete product image. ' . mysql_error()); if (dbNumRows($result)) { $row = dbFetchAssoc($result); extract($row); if ($pd_image && $pd_thumbnail) { // remove the image file $deleted = @unlink(SRV_ROOT . "images/product/{$pd_image}"); $deleted = @unlink(SRV_ROOT . "images/product/{$pd_thumbnail}"); } } return $deleted; }
function updateCart() { $cartId = $_POST['hidCartId']; $productId = $_POST['hidProductId']; $itemQty = $_POST['txtQty']; $numItem = count($itemQty); $numDeleted = 0; $notice = ''; $i = 0; for ($i = 0; $i < $numItem; $i++) { $newQty = (int) $itemQty[$i]; if ($newQty < 1) { // remove this item from shopping cart deleteFromCart($cartId[$i]); $numDeleted += 1; } else { // check current stock $sql = "SELECT pd_name, pd_qty\n\t\t\t FROM tbl_product \n\t\t\t\t\tWHERE pd_id = {$productId[$i]}"; $result = dbQuery($sql); $row = dbFetchAssoc($result); if ($newQty > $row['pd_qty']) { // we only have this much in stock $newQty = $row['pd_qty']; // if the customer put more than // we have in stock, give a notice if ($row['pd_qty'] > 0) { setError('The quantity you have requested is more than we currently have in stock. The number available is indicated in the "Quantity" box. '); } else { // the product is no longer in stock setError('Sorry, but the product you want (' . $row['pd_name'] . ') is no longer in stock'); // remove this item from shopping cart deleteFromCart($cartId[$i]); $numDeleted += 1; } } // update product quantity $sql = "UPDATE tbl_cart\n\t\t\t\t\tSET ct_qty = {$newQty}\n\t\t\t\t\tWHERE ct_id = {$cartId[$i]}"; dbQuery($sql); } } if ($numDeleted == $numItem) { // if all item deleted return to the last page that // the customer visited before going to shopping cart header("Location: {$returnUrl}" . $_SESSION['shop_return_url']); } else { header('Location: cart.php'); } exit; }
switch ($tab) { case 'general': ?> <tr><td><?php echo translate('Name'); ?> </td><td><input type="text" name="newMonitor[Name]" value="<?php echo validHtmlStr($newMonitor['Name']); ?> " size="16"/></td></tr> <tr><td><?php echo translate('Server'); ?> </td><td> <?php $servers = dbFetchAssoc('SELECT Id,Name FROM Servers ORDER BY Name', 'Id', 'Name'); array_unshift($servers, 'None'); ?> <?php echo buildSelect("newMonitor[ServerId]", $servers); ?> </td></tr> <tr><td><?php echo translate('SourceType'); ?> </td><td><?php echo buildSelect("newMonitor[Type]", $sourceTypes); ?> </td></tr> <tr><td><?php echo translate('Function');
<th style="width:10%">Marca</th> <th style="width:9%">Precio</th> <th style="width:9%">Mayoreo</th> <th style="width:9%">Oferta</th> <th style="width:13%"><small>Oferta Mayoreo</small></th> </tr> </thead> <tbody> <?php // echo $lp; $articulos_cambiar = ""; $a_tot = dbNumRows($lp1); if ($a_tot > 0) { $c = 0; while ($row = dbFetchAssoc($lp1)) { $costo_dolar = $row['costo_dolar'] == NULL ? '' : number_format($row['costo_dolar'], 4, '.', ''); $costo_local = $row['costo_local'] == NULL ? '' : number_format($row['costo_local'], 2, '.', ''); $precio_local = $row['precio_local'] == NULL ? '' : number_format($row['precio_local'], 2, '.', ''); $mayoreo = $row['mayoreo'] == NULL ? '' : number_format($row['mayoreo'], 2, '.', ''); $oferta = $row['oferta'] == NULL ? '' : number_format($row['oferta'], 2, '.', ''); $oferta_mayoreo = $row['oferta_mayoreo'] == NULL ? '' : number_format($row['oferta_mayoreo'], 2, '.', ''); $articulos_cambiar .= $row['id'] . '|'; ?> <tr id="linea_<?php echo $row['id']; ?> "> <td><?php echo '<small>' . $row['codigo'] . '</small>';
function fetchCategories() { $sql = "SELECT cat_id, cat_parent_id, cat_name, cat_image, cat_description\r\n\t FROM tbl_category\r\n\t\t\tORDER BY cat_id, cat_parent_id "; $result = dbQuery($sql); $cat = array(); while ($row = dbFetchAssoc($result)) { $cat[] = $row; } return $cat; }
</td> <td> <input id="marca_addlinea" type="text" class="form-control input-xs" disabled> </td> <td align="right"> <button onClick="agregar_linea_nueva()" class="btn btn-primary btn-xs" ><span class="glyphicon glyphicon-plus"></span></button> </td> </tr> <?php $pd = "SELECT a.codigo as codigo, pd.cantidad as cantidad, \n (SELECT nombre FROM variados WHERE tipo=2 AND id=a.uni_med) as uni_med, \n a.nombre as nombre,(SELECT nombre FROM marca where id = a.marca_id) as marca, \n pd.id as ingreso_d_id,\n IFNULL((SELECT stock FROM inventario where active = 1 AND articulo_id=pd.articulo_id),0) as stock\n FROM ingreso_d as pd, articulo as a\n WHERE pd.active = 1 AND pd.ingreso_id={$id_ingreso} AND pd.articulo_id = a.id"; $pd1 = dbQuery($pd); $pd_num = dbNumRows($pd1); if ($pd_num > 0) { while ($pd2 = dbFetchAssoc($pd1)) { ?> <tr id= "linea_<?php echo $pd2['ingreso_d_id']; ?> " > <td><?php echo '<small>' . $pd2['codigo'] . '</small>'; ?> </td> <td> <input onMouseover="ver_saldo(<?php echo $pd2['ingreso_d_id']; ?>
} else { $item_id = $argv[1]; $element_id_to_transfer = $argv[2]; } // Run Query $q = "SELECT id from files where item_id=" . $item_id; $result = dbQuery($q); if (dbNumRows($result) > 0) { while ($row = dbFetchAssoc($result)) { $rec_id = $row['id']; $q2 = "SELECT text from element_texts where element_id=" . $element_id_to_transfer . " and record_type='File' and record_id =" . $rec_id; $result2 = dbQuery($q2); if (dbNumRows($result2) > 0) { #while($row2 = dbFetchAssoc($result2)){ #$u = "UPDATE files SET `order`=" . $row2['text'] . " where id=" . $rec_id; # echo $u . "\n"; # $rs = dbQuery($u); while ($row2 = dbFetchAssoc($result2)) { if (preg_match('/^0+/', $row2['text'])) { $padding_cleanup = preg_split("/^0+/", $row2['text']); $order = $padding_cleanup[1]; } else { $order = $row2['text']; } $u = "UPDATE files SET `order`=" . $order . " where id=" . $rec_id; echo $u . "\n"; $rs = dbQuery($u); } } } }
<?php if (!defined('WEB_ROOT')) { exit; } // make sure a category id exists if (isset($_GET['catId']) && (int) $_GET['catId'] > 0) { $catId = (int) $_GET['catId']; } else { header('Location:index.php'); } $sql = "SELECT cat_id, cat_name\r\n\t\tFROM tbl_category\r\n\t\tWHERE cat_id = {$catId}"; $result = dbQuery($sql); $row = dbFetchAssoc($result); extract($row); ?> <p> </p> <form action="processCategory.php?action=modify&catId=<?php echo $catId; ?> " method="post" enctype="multipart/form-data" name="frmCategory" id="frmCategory"> <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="entryTable"> <tr> <td width="150" class="label">Category Name</td> <td class="content"><input name="txtName" type="text" class="box" id="txtName" value="<?php echo $cat_name; ?> " size="30" maxlength="50"></td> </tr>
if (!defined('WEB_ROOT')) { exit; } $sql = "SELECT SU_id, name FROM universities ORDER BY SU_id"; $universityList = dbQuery($sql) or die('Cannot get Course. ' . mysql_error()); ?> <p> </p> <form action="processCourse.php?action=addCourse" method="post" enctype="multipart/form-data" name="frmAddCourse" id="frmAddCourse"> <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="entryTable"> <tr><td colspan="2" id="entryTableHeader">Add Course</td></tr> <tr> <td width="150" class="label">Taught at Universities</td> <td class="content"> <?php while ($row1 = dbFetchAssoc($universityList)) { extract($row1); ?> <input type="checkbox" name="univnamesforcourse[]" checked="checked" value="<?php echo $SU_id; ?> " /><?php echo $name; ?> <br> <?php } ?> </td> </tr>
<script type="text/JavaScript"> </script> <?php $fid = (int) $_GET['fId']; $sql = "SELECT * FROM tbl_faculty WHERE fid = {$fid}"; $result = dbQuery($sql); while ($data = dbFetchAssoc($result)) { extract($data); ?> <h3>Edit Faculty Details - Admin View</h3> <form action="process.php?action=editFaculty" method="post" name="frmListUser" id="frmListUser"> <table width="600" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#336699" class="entryTable"> <tr id="entryTableHeader"> <td>:: Add Faculty Details ::</td> </tr> <tr> <td class="contentArea"><div class="errorMessage" align="center"><?php //echo $errorMessage; ?> </div> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="text"> <tr align="center"> <td colspan="2"><div align="right"> <input type="hidden" name="fid" value="<?php echo $fid; ?> " /> </div></td> </tr> <tr class="entryTable"> <td class="label"> User Name</td>
<?php if (!defined('WEB_ROOT')) { exit; } if (isset($_GET['userId']) && (int) $_GET['userId'] > 0) { $userId = (int) $_GET['userId']; } else { header('Location: index.php'); } $errorMessage = isset($_GET['error']) && $_GET['error'] != '' ? $_GET['error'] : ' '; $sql = "SELECT user_name\n FROM tbl_user\n WHERE user_id = {$userId}"; $result = dbQuery($sql); extract(dbFetchAssoc($result)); ?> <p class="errorMessage"><?php echo $errorMessage; ?> </p> <form action="processUser.php?action=modify" method="post" enctype="multipart/form-data" name="frmAddUser" id="frmAddUser"> <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="entryTable"> <tr> <td width="150" class="label">User Name</td> <td class="content"><input name="txtUserName" type="text" class="box" id="txtUserName" value="<?php echo $user_name; ?> " size="20" maxlength="20"> <input name="hidUserId" type="hidden" id="hidUserId" value="<?php
if ($existe_permiso > 0) { echo 'checked'; } ?> ></div> <span ><i class="icon-folder-open"></i> <?php echo $row['nombre']; ?> </span> <ul> <?php $sc = "SELECT * FROM modulo WHERE active = 1 AND padre = " . $row['id']; $sc1 = dbQuery($sc); while ($sc2 = dbFetchAssoc($sc1)) { $pom = "SELECT * FROM permiso WHERE active = 1 AND usuario_id = {$id_usuario} AND modulo_id=" . $sc2['id']; $pom1 = dbQuery($pom); $pexiste_permiso = dbNumRows($pom1); ?> <li> <div class="badge badge-nocolor"> <input type="checkbox" id="chijo_<?php echo $sc2['id']; ?> " name="modulos" value="<?php echo $sc2['id']; ?> " class="hijo_<?php echo $row['id']; ?> " <?php
function assignComplainFac() { //echo 'Make Complain...'; $compId = $_POST['compId']; $engId = (int) $_POST['engId']; $sql = "SELECT ename FROM tbl_employee WHERE eid = {$engId}"; $result = dbQuery($sql); while ($row = dbFetchAssoc($result)) { $eng_name = $row['ename']; } $sql = "UPDATE tbl_complainsf \n\t\t\tSET status = 'assigned', \n\t\t\t\teng_id = {$engId}, \n\t\t\t\teng_name = '{$eng_name}'\n\t\t\tWHERE cid = {$compId}"; // echo $sql; $result = dbQuery($sql); header("Location: view.php?mod=admin&view=compDetails"); exit; }
?> )" class="btn btn-danger btn-xs" ><span class="glyphicon glyphicon-trash"></span></button> </td> </tr> <?php } //fin del while de el detalle del pedido } //fin del if que checkea si existe detalle en el pedido $servicios = "SELECT a.codigo as codigo, pd.cantidad as cantidad, \n (SELECT inventario FROM articulo WHERE id=pd.articulo_id) as inventario_art,\n \n (SELECT nombre FROM variados WHERE tipo=2 AND id=a.uni_med) as uni_med, \n a.nombre as nombre,(SELECT nombre FROM marca where id = a.marca_id) as marca, \n pd.precio_local as precio_local, pd.total as total,\n (SELECT mayoreo FROM precio WHERE listado_precio_id=1 AND active = 1 AND articulo_id=pd.articulo_id) as mayoreo,\n (SELECT oferta FROM precio WHERE listado_precio_id=1 AND active = 1 AND articulo_id=pd.articulo_id) as oferta,\n (SELECT oferta_mayoreo FROM precio WHERE listado_precio_id=1 AND active = 1 AND articulo_id=pd.articulo_id) as oferta_mayoreo,\n (SELECT precio_local FROM precio WHERE listado_precio_id=1 AND active = 1 AND articulo_id=pd.articulo_id) as pl,\n pd.id as pedido_d_id,\n IFNULL((SELECT stock FROM inventario where active = 1 AND articulo_id=pd.articulo_id),0) as stock\n FROM pedido_d as pd, articulo as a\n WHERE pd.active = 1 AND pd.pedido_id={$id_pedido} AND pd.articulo_id = a.id \n having inventario_art = 0\n "; //echo $servicios; $servicios1 = dbQuery($servicios); $servicios_num = dbNumRows($servicios1); if ($servicios_num > 0) { $cont = 0; while ($pd2 = dbFetchAssoc($servicios1)) { if ($cont == 0) { //primer linea dividada x lineas punteadas para identificarlo del resto del detalle ?> <tr id= "linea_<?php echo $pd2['pedido_d_id']; ?> "> <td class="dashline"><?php echo '<small>' . $pd2['codigo'] . '</small>'; ?> </td> <td class="dashline"> <input disabled id="input_<?php echo $pd2['pedido_d_id'];
} else { if ($sscat == 0 && $scat == 0 && $cat == 0) { $a = "SELECT id, codigo, codant, nombre,uni_med, \n\t\t\t\t (SELECT if (costo_local = NULL, 0.00, costo_local) FROM precio WHERE articulo_id=articulo.id AND active = 1 AND listado_precio_id=1) as costo_local, \n\t\t\t\t(SELECT precio_local FROM precio WHERE articulo_id=articulo.id AND active = 1 AND listado_precio_id=1) as precio_local,\n\t\t\t\t(SELECT costo_dolar FROM precio WHERE articulo_id=articulo.id AND active = 1 AND listado_precio_id=1) as costo_dolar,\n\t\t\t\t(SELECT oferta_unidad FROM precio WHERE articulo_id=articulo.id AND active = 1 AND listado_precio_id=1) as oferta_unidad\n\t\t\t\tFROM articulo WHERE active = 1\n\t\t\t\t"; } else { $a = ""; } } } echo $a; $a1 = dbQuery($a); $a_tot = dbNumRows($a1); $return = ""; $articulos_cambiar = ""; if ($a_tot > 0) { $c = 0; while ($row = dbFetchAssoc($a1)) { //$var = 5; //$var_is_greater_than_two = ($var > 2 ? true : false); // returns true $costo_local = $row['costo_local'] == NULL ? 0 : $row['costo_local']; $precio_local = $row['precio_local'] == NULL ? 0 : $row['precio_local']; $costo_dolar = $row['costo_dolar'] == NULL ? 0 : $row['costo_dolar']; $oferta_unidad = $row['oferta_unidad'] == NULL ? 0 : $row['oferta_unidad']; //if($row['costo_local']== NULL || $row['costo_local'] ==''){ $c++; $return .= "<tr>"; $return .= "<td class='col-md-0.5'>" . $row['codigo'] . "</td>"; $return .= "<td class='col-md-0.5'>" . $row['codant'] . "</td>"; $return .= "<td class='col-md-3'>" . $row['nombre'] . "</td>"; $return .= "<td class='col-md-2'>" . $precio_local . "</td>"; $return .= "<td class='col-md-2'>" . $precio_local * 0.93 . "</td>"; $return .= "<td class='col-md-2'>" . $oferta_unidad . "</td>";
<li><a href="../../include/logout.php">Log Out</a></li> </ul> </div> </div> </div> <div class="container-fluid"> <div class="row"> <div class="col-md-3 col-md-2 sidebar"> <ul class="nav nav-sidebar"> <?php $link = "#"; $m = "SELECT * FROM modulo WHERE active = '1' AND tipo = 1 and padre=" . $_GET['m'] . " ORDER BY orden"; $m1 = dbQuery($m); while ($mrow = dbFetchAssoc($m1)) { $p = "SELECT * from permiso WHERE active = 1 AND usuario_id =" . $_SESSION['id_user'] . " AND modulo_id = " . $mrow['id']; $p1 = dbQuery($p); $pfila = dbNumRows($p1); if ($mrow['link'] === NULL) { $link = "#"; } else { $link = $mrow['link'] . '?m=' . $mrow['padre']; } if ($pfila > 0) { ?> <li class="<?php if ($mrow['nombre'] == 'Permisos') { echo 'active'; } ?>
<h3>Faculty Details - Admin View</h3> <p>To add New Faculty <a href="view.php?mod=admin&view=addFaculty">Click Here</a> </p> <form action="" method="post" name="frmListUser" id="frmListUser"> <table width="680" border="0" align="center" cellpadding="2" cellspacing="1" class="text"> <tr align="center" id="listTableHeader"> <td width="453">Faculty Name </td> <td width="">Email</td> <td width="265">Mobile No. </td> <td width="207">Detail</td> </tr> <?php $cust_id = (int) $_SESSION['user_id']; $sql = "SELECT * \n\t\t\tFROM tbl_faculty\n\t\t\tORDER BY fname ASC"; $result = dbQuery($sql); $i = 0; while ($row = dbFetchAssoc($result)) { extract($row); if ($i % 2) { $class = 'row1'; } else { $class = 'row2'; } $i += 1; ?> <tr class="<?php echo $class; ?> " style="height:25px;"> <td> <?php echo ucwords($fname); ?>
<th style="width:15%">Fecha Cierre</th> <th style="width:15%">Fecha Pago</th> <th style="width:5%">Dias</th> <th style="width:10%">Total</th> <th style="width:10%">Abonos</th> <th style="width:10%">Saldo</th> </tr> </thead> <tbody> <?php // style="width:10%" $q = "SELECT *, date(fecha_cierre) as fc, date(fecha_de_pago) as fd,\n (SELECT SUM(total) FROM factura_d WHERE active = 1 AND factura_id= factura.id) as total,\n datediff( IFNULL(fecha_de_pago,now()) , fecha_cierre) as dias, \n (IFNULL((SELECT sum(total) FROM factura_d WHERE factura_id = factura.id AND active=1),0))*0.01 as sseguro,\n (IFNULL((SELECT sum(total) FROM factura_d WHERE factura_id = factura.id AND active=1),0))*0.01 as sflete,\n IFNULL((SELECT sum(peso_total) FROM factura_d WHERE factura_id = factura.id AND active=1),0) as peso,\n IFNULL((SELECT sum(monto) FROM abonos WHERE factura_id = factura.id AND active=1),0) as abonos\n FROM factura \n WHERE active = 1 AND (status = 2 OR status = 3) AND cliente_id={$id}\n AND fecha_cierre BETWEEN '{$fecha_inicio}' AND '{$fecha_fin}' \n ORDER BY status\n "; //echo $q; $q1 = dbQuery($q); while ($q2 = dbFetchAssoc($q1)) { //while q pondra cada factura, ya q depliego la comision x cada factura //calculo de gautex, flete y seguro/// $seguro = number_format($q2['sseguro'], 2, '.', ''); $flete = number_format($q2['sflete'], 2, '.', ''); //$peso = number_format($row['peso'],2,'.',''); $peso = number_format(floatval($q2['peso'] * 0.00220462), 2, '.', ''); // peso en LIBRAS $centenas = ceil($peso / 100); $guatex = number_format($centenas * 16, 2, '.', ''); //calculo de guatex $total_detalle = number_format($q2['total'], 2, '.', ''); $subtotal = 0.0; $total = 0.0; if ($q2['seguro'] == 1) { $subtotal = $subtotal + $seguro;