| Server IP : 27.254.152.13 / Your IP : 216.73.217.38 Web Server : Apache/2 System : Linux ns1-252017.dragonhispeed.com 5.2.0 #1 SMP Fri Mar 29 22:50:14 MSK 2024 x86_64 User : coloflew ( 1072) PHP Version : 5.6.40 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/coloflew/domains/fulltion.com/public_html/administrator/modules/manu_setupinvoice/ |
Upload File : |
<?php
function UpdateProduct($id){
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/lib/class/SC_Query.php');
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/lib/class/SC_Mysql.php');
$db = new SC_Query();
$arrSum = array();
$getsum = $db->getAll( "invoicedetail", "sum(ProductWeightPriceSum+ProductSizePriceSum) as sumary , sum(ProductDiscount) as discount "," InvoiceID = '".$id."'","" );
foreach($getsum as $key => $val){
$arrSum['InvoiceSumary'] = $val["sumary"];
$arrSum['InvoiceDiscountSum'] = $val["discount"];
}
$db->updateData("invoice",$arrSum," InvoiceID='".$id."'");
}
if(@$_GET['act']=="add"){
$arrData = array();
$arrData['InvoiceID'] = $_GET['InvoiceID'];
$arrData['ProductCode'] = $_POST['ProductCode'];
$arrData['ProductName'] = $_POST['ProductName'];
$arrData['ProductUnit'] = $_POST['ProductUnit'];
$arrData['ProductUnitType'] = $_POST['ProductUnitType'];
$arrData['ProductWeight'] = $_POST['ProductWeight'];
$arrData['ProductWeightType'] = $_POST['ProductWeightType'];
$arrData['ProductWeightPriceSum'] = $_POST['ProductWeightPriceSum'];
$arrData['ProductSize'] = $_POST['ProductSize'];
$arrData['ProductSizeType'] = $_POST['ProductSizeType'];
$arrData['ProductSizePriceSum'] = $_POST['ProductSizePriceSum'];
$arrData['ProductDiscount'] = $_POST['ProductDiscount'];
foreach($arrData as $k => $v ){
$arrData[$k] = str_replace("'", "\'", $v);
}
//echo "<pre>"; print_r($arrData);
//exit;
$db->insertData("invoicedetail",$arrData);
UpdateProduct($_GET['InvoiceID']);
//exit;
$msg = "Save Data complete.";
$res = true;
}elseif(@$_GET['act']=="editdata"){
$arrData = array();
$arrData['InvoiceID'] = $_GET['InvoiceID'];
$arrData['ProductCode'] = $_POST['ProductCode'];
$arrData['ProductName'] = $_POST['ProductName'];
$arrData['ProductUnit'] = $_POST['ProductUnit'];
$arrData['ProductUnitType'] = $_POST['ProductUnitType'];
$arrData['ProductWeight'] = $_POST['ProductWeight'];
$arrData['ProductWeightType'] = $_POST['ProductWeightType'];
$arrData['ProductWeightPriceSum'] = $_POST['ProductWeightPriceSum'];
$arrData['ProductSize'] = $_POST['ProductSize'];
$arrData['ProductSizeType'] = $_POST['ProductSizeType'];
$arrData['ProductSizePriceSum'] = $_POST['ProductSizePriceSum'];
$arrData['ProductDiscount'] = $_POST['ProductDiscount'];
foreach($arrData as $k => $v ){
$arrData[$k] = str_replace("'", "\'", $v);
}
$db->updateData("invoicedetail",$arrData," InvoiceDetailID='".$_POST['InvoiceDetailID']."'");
UpdateProduct($_GET['InvoiceID']);
$msg = "Edit Data complete.";
$res = true;
}elseif(@$_GET['act']=="edit"){
$arrRes = $db->getOne("invoicedetail","*"," InvoiceDetailID='".$_GET['InvoiceDetailID']."'");
}elseif(@$_GET['act']=="deletedata"){
$db->deleteData("invoicedetail"," InvoiceDetailID='".$_GET['InvoiceDetailID']."'");
UpdateProduct($_GET['InvoiceID']);
$msg = "Delete Data complete.";
$res = true;
}elseif(@$_GET['act']=="deleteAll"){
//echo "<pre>"; print_r(@$_POST);
if(count(@$_POST['pagedel']) > 0){
foreach(@$_POST['pagedel'] as $key => $val){
$db->deleteData("invoicedetail"," InvoiceDetailID='".$val."'");
}
}
UpdateProduct($_GET['InvoiceID']);
$msg = "Delete Data complete.";
$res = true;
}
$where_f = " InvoiceID='".$_GET['InvoiceID']."'";
$page = @$_GET['page'] ? @$_GET['page'] : 1;
$arrpageP = $db->getAll( "invoicedetail", "*",$where_f,"" );
$arrPage = $objMaster->viewPages($page, $arrpageP, "15");
$getPage = $db->getAll("invoicedetail","*",$where_f,"",$arrPage["offset"]);
//echo "<pre>"; print_r($getPage);
?>
<!-- Start Content Box -->
<div class="content-box">
<!-- Start Content Box Header-->
<div class="content-box-header">
<h3><?php echo $lang_set['product_title']; ?></h3>
<ul class="content-box-tabs">
<li><a href="#list" <?php echo ($_GET['act']=="" ? 'class="default-tab"' : '');?>><?php echo $lang_set['list_product']; ?></a></li> <!-- href must be unique and match the id of target div -->
<li><a href="#add" <?php echo ($_GET['act']=="edit" ? 'class="default-tab"' : '');?>><?php echo $lang_set['add_product']; ?></a></li>
</ul>
<div class="clear"></div>
</div>
<!-- End Content Box Header-->
<!-- Start Content Box Content-->
<div class="content-box-content">
<?php if($res){?>
<div class="notification success png_bg">
<a href="#" class="close"><img src="resources/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
<div>
<?php echo $msg;?>
</div>
</div>
<meta http-equiv="refresh" content="1;URL=index.php?name=manu_setupinvoice&file=product&InvoiceID=<?php echo $_GET['InvoiceID']?>">
<?php }?>
<!-- Start Tab Content id="list"-->
<div class="tab-content <?php echo ($_GET['act']=="" ? 'default-tab' : '');?>" id="list">
<form action="index.php?name=manu_setupinvoice&file=product&InvoiceID=<?php echo $_GET['InvoiceID']?>&act=deleteAll" method="post">
<table cellpadding="0" cellspacing="0" width="100%">
<thead>
<tr>
<th width="20"><input type="checkbox" class="check_all" /></th>
<th width="50" align="left"><?php echo $lang_set['product_code']; ?></th>
<th width="100" align="left"><?php echo $lang_set['product_name']; ?></th>
<th width="100" align="left"><?php echo $lang_set['product_unit']; ?></th>
<th width="100" align="left"><?php echo $lang_set['product_weight']; ?></th>
<th width="100" align="left"><?php echo $lang_set['product_size']; ?></th>
<th width="100" align="left"><?php echo $lang_set['product_discount']; ?></th>
<th width="100" align="left"><?php echo $lang_set['product_sum']; ?></th>
<th width="77"><?php echo $lang_set['action']; ?></th>
</tr>
</thead>
<?php
if($getPage){
foreach($getPage as $key => $val){
?>
<tr>
<th><input type="checkbox" name="pagedel[]" value="<?php echo $val['InvoiceDetailID'];?>"/></th>
<th><?php echo $val['ProductCode'];?></th>
<th><?php echo $val['ProductName'];?></th>
<th><?php echo $val['ProductUnit'];?>/<?php echo $val['ProductUnitType'];?></th>
<th><?php echo $val['ProductWeight'];?>/<?php echo $val['ProductWeightType'];?></th>
<th><?php echo $val['ProductSize'];?>/<?php echo $val['ProductSizeType'];?></th>
<th><?php echo $val['ProductDiscount'];?></th>
<th><?php echo $val['ProductWeightPriceSum'] + $val['ProductSizePriceSum'] - $val['ProductDiscount'];?></th>
<th>
<a href="index.php?name=manu_setupinvoice&file=product&InvoiceID=<?php echo $_GET['InvoiceID']?>&act=edit&InvoiceDetailID=<?php echo $val['InvoiceDetailID']?>#add" title="Edit"><img src="resources/images/icons/pencil.png" alt="Edit" /></a> |
<a href="index.php?name=manu_setupinvoice&file=product&InvoiceID=<?php echo $_GET['InvoiceID']?>&act=deletedata&InvoiceDetailID=<?php echo $val['InvoiceDetailID']?>" title="Delete"><img src="resources/images/icons/cross.png" alt="Delete" /></a>
</th>
</tr>
<?php
}
}else{
?>
<tr>
<th colspan="11" style="text-align:center"><?php echo $lang_set['not_data']; ?></th>
</tr>
<?php
}
?>
<tfoot>
<tr>
<td colspan="11">
<div class="bulk-actions align-left">
<select name="actdel">
<option value="del"><?php echo $lang_set['delete']; ?></option>
</select>
<input class="button" type="submit" value="<?php echo $lang_set['selected']; ?>" />
</div>
<!-- Start .pagination -->
<div class="pagination">
<a href="index.php?name=manu_setupinvoice&file=product&InvoiceID=<?php echo $_GET['InvoiceID']?>&page=<?php echo $arrPage["startPage"];?>" title="First Page">« First</a><a href="index.php?name=manu_setupinvoice&file=product&InvoiceID=<?php echo $_GET['InvoiceID']?>&page=<?php echo ($page-1);?>" title="Previous Page">« Previous</a>
<?php if( $arrPage["startPage"]!="" && $arrPage["endPage"] !="" ){?>
<?php
for($i = $arrPage["startPage"]; $i <= $arrPage["endPage"]; ++$i) {
echo'<a href="index.php?name=manu_setupinvoice&file=product&InvoiceID='.$_GET["InvoiceID"].'&page='.$i.'" '.($page == $i ? 'class="number current"' : '').'>'.($i).'</a>';
}?>
<?php }?>
<a href="index.php?name=manu_setupinvoice&file=product&InvoiceID=<?php echo $_GET['InvoiceID']?>&page=<?php echo ($page+1);?>" title="Next Page">Next »</a><a href="index.php?name=manu_setupinvoice&file=product&InvoiceID=<?php echo $_GET['InvoiceID']?>&page=<?php echo $arrPage["endPage"];?>" title="Last Page">Last »</a>
</div>
<!-- End .pagination -->
<div class="clear"></div>
</td>
</tr>
</tfoot>
</table>
</form>
</div>
<!-- End Tab Content id="list"-->
<!-- Start Tab Content id="add"-->
<div class="tab-content <?php echo ($_GET['act']=="edit" ? 'default-tab' : '');?>" id="add">
<form action="index.php?name=manu_setupinvoice&file=product&InvoiceID=<?php echo $_GET['InvoiceID']?>&act=<?php echo ($_GET['act']=="edit" ? "editdata" : "add");?>#add" method="post" enctype="multipart/form-data" ><!--onsubmit="return checkdelivery();"-->
<fieldset>
<input type="hidden" name="InvoiceDetailID" value="<?php echo $_GET['InvoiceDetailID'];?>">
<p>
<label><?php echo $lang_set['product_code']; ?>:</label>
<input type="text" class="text-input small-input" name="ProductCode" id="ProductCode" value="<?php echo @$arrRes['ProductCode'];?>" />
<!--<span class="input-notification error png_bg" id="span_name"></span>--></p>
<p>
<label><?php echo $lang_set['product_name']; ?>:</label>
<input type="text" class="text-input medium-input" name="ProductName" id="ProductName" value="<?php echo @$arrRes['ProductName'];?>" />
<!--<span class="input-notification error png_bg" id="span_name"></span>--></p>
<p>
<label><?php echo $lang_set['product_unit']; ?>:</label>
<input type="text" class="text-input small-input" name="ProductUnit" id="ProductUnit" value="<?php echo @$arrRes['ProductUnit'];?>" />
<select name="ProductUnitType">
<option value="Unit">Unit</option>
</select>
<!--<span class="input-notification error png_bg" id="span_name"></span>--></p>
<p>
<label><?php echo $lang_set['product_weight']; ?>:</label>
<input type="text" class="text-input small-input" name="ProductWeight" id="ProductWeight" value="<?php echo @$arrRes['ProductWeight'];?>" />
<select name="ProductWeightType">
<option value="Unit">Unit</option>
</select>
<!--<span class="input-notification error png_bg" id="span_name"></span>--></p>
<p>
<label><?php echo $lang_set['product_weightpricesum']; ?>:</label>
<input type="text" class="text-input small-input" name="ProductWeightPriceSum" id="ProductWeightPriceSum" value="<?php echo @$arrRes['ProductWeightPriceSum'];?>" />
<!--<span class="input-notification error png_bg" id="span_name"></span>--></p>
<p>
<label><?php echo $lang_set['product_size']; ?>:</label>
<input type="text" class="text-input small-input" name="ProductSize" id="ProductSize" value="<?php echo @$arrRes['ProductSize'];?>" />
<select name="ProductSizeType">
<option value="Unit">Unit</option>
</select>
<!--<span class="input-notification error png_bg" id="span_name"></span>--></p>
<p>
<label><?php echo $lang_set['product_sizepricesum']; ?>:</label>
<input type="text" class="text-input small-input" name="ProductSizePriceSum" id="ProductSizePriceSum" value="<?php echo @$arrRes['ProductSizePriceSum'];?>" />
<!--<span class="input-notification error png_bg" id="span_name"></span>--></p>
<p>
<label><?php echo $lang_set['product_discount']; ?>:</label>
<input type="text" class="text-input small-input" name="ProductDiscount" id="ProductDiscount" value="<?php echo @$arrRes['ProductDiscount'];?>" />
<!--<span class="input-notification error png_bg" id="span_name"></span>--></p>
<p>
<input type="submit" class="button" value="<?php echo $lang_set['submit']; ?>" />
</p>
</fieldset>
</form>
</div>
<!-- End Tab Content id="add"-->
</div>