示例#1
0
<?php

session_start();
require_once 'core/init.php';
if (isset($_POST['update_password'])) {
    $user_id = $_SESSION['uid'];
    $new_password = md5($_POST['newPwd']);
    $BranchObj = new branch(null, $new_password, null, null);
    $res = $BranchObj->updatePwd($user_id);
    if ($res) {
        $_GET['update_success'] = 1;
        header("location:branch_page.php?update_success=1");
    } else {
        header("location:branch_page.php?update_success=0");
    }
}
?>


示例#2
0
<?php

require_once 'object_set.php';
class branch extends object_set
{
    function table_name()
    {
        return "t_branch";
    }
    function auto_id()
    {
        return true;
    }
}
$branch = new branch();
$branch->process();
示例#3
0
 private function saveLote($factura)
 {
     $account = DB::table('accounts')->where('id', '=', Auth::user()->account_id)->first();
     $branch = Branch::find(Session::get('branch_id'));
     // return $factura['nit'];
     $client = Client::where('account_id', '=', Auth::user()->account_id)->where('public_id', $factura['id'])->first();
     //if(!$client)
     //   return $factura['nit'];
     $invoice = Invoice::createNew();
     $invoice->setPublicNotes($factura['nota']);
     $invoice->setBranch(Session::get('branch_id'));
     $invoice->setInvoiceDate(date("Y-m-d"));
     $invoice->setClient($client->id);
     $invoice->setEconomicActivity($branch->economic_activity);
     $invoice->setDiscount(0);
     $invoice->setClientName($client->name);
     $invoice->setClientNit($client->nit);
     $invoice->setUser(Auth::user()->id);
     //$date=date("Y-m-d",strtotime(Input::get('invoice_date')));
     //$invoice->setInvoiceDate($date);
     $total_cost = 0;
     foreach ($factura['products'] as $producto) {
         //$pr = Product::where('account_id',Auth::user()->account_id)->where('product_key',$producto['product_key'])->first();
         //$total_cost+= $pr->cost*$producto['qty'];
         $total_cost += $producto['cost'];
     }
     $invoice->importe_neto = trim($total_cost);
     $invoice->importe_total = trim($total_cost);
     //$invoice->note = trim(Input::get('nota'));
     $invoice->setAccountName($account->name);
     $invoice->setAccountNit($account->nit);
     $invoice->setBranchName($branch->name);
     $invoice->setAddress1($branch->address1);
     $invoice->setAddress2($branch->address2);
     $invoice->setPhone($branch->work_phone);
     $invoice->setCity($branch->city);
     $invoice->setState($branch->state);
     $invoice->setNumberAutho($branch->number_autho);
     $invoice->setKeyDosage($branch->key_dosage);
     $invoice->setTypeThird($branch->type_third);
     $invoice->setDeadline($branch->deadline);
     $invoice->setLaw($branch->law);
     $type_document = TypeDocument::where('account_id', Auth::user()->account_id)->first();
     $invoice->invoice_number = branch::getInvoiceNumber();
     $numAuth = $invoice->number_autho;
     $numfactura = $invoice->invoice_number;
     $nit = $invoice->client_nit;
     $fechaEmision = date("Ymd", strtotime($invoice->invoice_date));
     $total = $invoice->importe_neto;
     $llave = $branch->key_dosage;
     $codigoControl = Utils::getControlCode($numfactura, $nit, $fechaEmision, $total, $numAuth, $llave);
     $invoice->setControlCode($codigoControl);
     $documents = TypeDocumentBranch::where('branch_id', $invoice->branch_id)->orderBy('id', 'ASC')->get();
     foreach ($documents as $document) {
         $actual_document = TypeDocument::where('id', $document->type_document_id)->first();
         if ($actual_document->master_id == 1) {
             $id_documento = $actual_document->id;
         }
     }
     $invoice->setJavascript($id_documento);
     $invoice->logo = 1;
     $invoice->sfc = $branch->sfc;
     //$invoice->qr =$invoice->account_nit.'|'.$invoice->invoice_number.'|'.$invoice->number_autho.'|'.$invoice->invoice_date.'|'.$invoice->importe_neto.'|'.$invoice->importe_total.'|'.$invoice->client_nit.'|'.$invoice->importe_ice.'|0|0|'.$invoice->descuento_total;
     if ($account->is_uniper) {
         $invoice->account_uniper = $account->uniper;
     }
     //$invoice->logo = $type_document->logo;
     $invoice->save();
     foreach ($factura['products'] as $producto) {
         $product = Product::where('account_id', Auth::user()->account_id)->where('product_key', $producto['product_key'])->first();
         if ($product != null) {
             $invoiceItem = InvoiceItem::createNew();
             $invoiceItem->setInvoice($invoice->id);
             $invoiceItem->setProduct($product->id);
             $invoiceItem->setProductKey($product->product_key);
             $invoiceItem->setNotes($product->notes . " " . $producto['description']);
             $invoiceItem->setCost($producto['cost']);
             $invoiceItem->setQty(1);
             $invoiceItem->save();
         }
     }
 }
示例#4
0

<div class="container-fluide">
	
	<ul class="breadcrumb">
	    <li><a href="#">Home</a></li>
	    <li><a class="active" href="#">Branches</a></li>
	</ul>

<div class="page-heading">
	<h1>View Branches</h1>
</div>

	<div class="table-responsive custom-table">
		<?php 
$branch = new branch();
$results = $branch->get_branches();
if ($results) {
}
?>
		<table id="myTable">  
	        <thead>  
	          <tr>  
	            <th>ID</th>  
	            <th>Company</th>  
	            <th>Name</th>  
	            <th>Location</th>  
	            <th>Desc</th> 
	            <th></th>  
	          </tr>  
	        </thead>  
if (isset($_SESSION['company_id'])) {
    ?>
	
	<ul class="breadcrumb">
	    <li><a href="#">Home</a></li>
	    <li><a href="view_branch_item.php">Items</a></li>
	    <li><a class="active" href="#" >Add</a></li>
	</ul>

<div class="page-heading">
	<h1>Add Item</h1>
</div>

<div class="form-container">
<?php 
    $branch = new branch();
    $all_branch = $branch->get_branches();
    $branch_category = new branch_category();
    $all_branch_category = $branch_category->get_branch_category();
    $branch_menu_type = new branch_menu_type();
    $all_branch_menu_type = $branch_menu_type->get_branch_menu_type();
    $branch_spice = new branch_spice();
    $all_branch_spice = $branch_spice->get_branch_spice();
    $branch_item = new branch_item();
    $ID = isset($_GET['id']) ? $_GET['id'] : NULL;
    if (isset($_POST['add_branch_item'])) {
        // Update old record
        if (isset($ID)) {
            $results = $branch_item->update_branch_item($_POST, $ID);
        } else {
            // Insert new
<div class="container-fluide">
<?php 
if (isset($_SESSION['company_id'])) {
    ?>
	<ul class="breadcrumb">
	    <li><a href="#">Home</a></li>
	    <li><a class="active" href="#">Branches Items</a></li>
	</ul>

<div class="page-heading">
	<h1>View Items</h1>
</div>

	<div class="table-responsive custom-table">
		<?php 
    $branch = new branch();
    $branch_item = new branch_item();
    $results = $branch_item->get_branch_item();
    ?>
		<table id="myTable">  
	        <thead>  
	          <tr>  
	            <th>Name</th>  
	            <th>Branch</th>  
	            <th>Category</th> 
	            <th>Menu Type</th> 
	            <th>Status</th> 
	            <th></th>  
	          </tr>  
	        </thead>  
	        <tbody>  
示例#7
0
if (isset($_SESSION['company_id'])) {
    ?>
	
	<ul class="breadcrumb">
	    <li><a href="#">Home</a></li>
	    <li><a href="view_branch.php">Branches</a></li>
	    <li><a class="active" href="#" >Add</a></li>
	</ul>

<div class="page-heading">
	<h1>Add Branch</h1>
</div>

<div class="form-container">
<?php 
    $branch = new branch();
    $company = new company();
    $ID = isset($_GET['id']) ? $_GET['id'] : NULL;
    if (isset($_POST['add_branch'])) {
        // Update old record
        if (isset($ID)) {
            $results = $branch->update_branch($_POST, $ID);
        } else {
            // Insert new
            $results = $branch->insert_branch($_POST);
        }
        if ($results) {
            echo '<div class="alert alert-success" role="alert">';
            echo isset($_GET['id']) ? 'Updated ' : 'Added ';
            echo 'branch Sucessfully </div>';
        } else {
<div class="container-fluide">
<?php 
if (isset($_SESSION['company_id'])) {
    ?>
	<ul class="breadcrumb">
	    <li><a href="#">Home</a></li>
	    <li><a class="active" href="#">Branches Users</a></li>
	</ul>

<div class="page-heading">
	<h1>View Branches Users</h1>
</div>

	<div class="table-responsive custom-table">
		<?php 
    $branch = new branch();
    $branch_user = new branch_user();
    $results = $branch_user->get_branch_user();
    if ($results) {
    }
    ?>
		<table id="myTable">  
	        <thead>  
	          <tr>  
	            <th>Name</th>  
	            <th>Branch</th>  
	            <th>Email</th>  
	            <th>Phone</th> 
	            <th>Status</th> 
	            <th></th>  
	          </tr>  
<div class="container-fluide">
<?php 
if (isset($_SESSION['company_id'])) {
    ?>
	<ul class="breadcrumb">
	    <li><a href="#">Home</a></li>
	    <li><a class="active" href="#">Branches Tables</a></li>
	</ul>

<div class="page-heading">
	<h1>View Tables</h1>
</div>

	<div class="table-responsive custom-table">
		<?php 
    $branch = new branch();
    $branch_table = new branch_table();
    $results = $branch_table->get_branch_table();
    ?>
		<table id="myTable">  
	        <thead>  
	          <tr>  
	            <th>Name</th> 
	            <th>Branch</th>  
	            <th>Status</th> 
	            <th></th>  
	          </tr>  
	        </thead>  
	        <tbody>  

	        <?php 
示例#10
0
 private function saveLote2($factura, $date)
 {
     //print_r($factura);
     //return;
     $account = DB::table('accounts')->where('id', '=', Auth::user()->account_id)->first();
     $branch = Branch::find(Session::get('branch_id'));
     $client = Client::where('account_id', '=', Auth::user()->account_id)->where('name', $factura['name'])->where('nit', $factura['nit'])->first();
     if (!$client) {
         ///echo "creo";
         $client = Client::createNew();
         $client->setNit(trim($factura['nit']));
         $client->setName(trim($factura['name']));
         $client->setBussinesName(trim($factura['razon']));
         $alt = $client->guardar();
         $client->save();
     }
     $invoice = Invoice::createNew();
     $invoice->setPublicNotes("");
     $invoice->setBranch(Session::get('branch_id'));
     $dateparser = explode("/", $date);
     $date = $dateparser[2] . '-' . $dateparser[1] . '-' . $dateparser[0];
     $invoice->setInvoiceDate($date);
     $invoice->setClient($client->id);
     $invoice->setEconomicActivity($branch->economic_activity);
     $invoice->setDiscount(0);
     $invoice->setClientName($client->business_name);
     $invoice->setClientNit($client->nit);
     $invoice->setUser(Auth::user()->id);
     $total_cost = 0;
     /*foreach ($factura['products'] as $producto)
       {
           $total_cost+= $producto['cost'];
       }*/
     $invoice->importe_neto = $factura['total'] * $factura['qty'];
     $invoice->importe_total = $factura['total'] * $factura['qty'];
     $invoice->debito_fiscal = $factura['total'] * $factura['qty'];
     //$invoice->note = trim(Input::get('nota'));
     $invoice->setAccountName($account->name);
     $invoice->setAccountNit($account->nit);
     $invoice->setBranchName($branch->name);
     $invoice->setAddress1($branch->address1);
     $invoice->setAddress2($branch->address2);
     $invoice->setPhone($branch->work_phone);
     $invoice->setCity($branch->city);
     $invoice->setState($branch->state);
     $invoice->setNumberAutho($branch->number_autho);
     $invoice->setKeyDosage($branch->key_dosage);
     $invoice->setTypeThird($branch->type_third);
     $invoice->setDeadline($branch->deadline);
     $invoice->setLaw($branch->law);
     $type_document = TypeDocument::where('account_id', Auth::user()->account_id)->firstOrFail();
     $invoice->invoice_number = branch::getInvoiceNumber();
     $numAuth = $invoice->number_autho;
     $numfactura = $invoice->invoice_number;
     $nit = $invoice->client_nit;
     $fechaEmision = date("Ymd", strtotime($invoice->invoice_date));
     $total = $invoice->importe_neto;
     $llave = $branch->key_dosage;
     $totalc = number_format((double) $total, 2, '.', '');
     if ($account->currency_id == 2) {
         $totalc = $total * $account->exchange;
         $totalc = number_format((double) $totalc, 2, '.', '');
     }
     $codigoControl = Utils::getControlCode($numfactura, $nit, $fechaEmision, $totalc, $numAuth, $llave);
     $invoice->setControlCode($codigoControl);
     $documents = TypeDocumentBranch::where('branch_id', $invoice->branch_id)->orderBy('id', 'ASC')->get();
     foreach ($documents as $document) {
         $actual_document = TypeDocument::where('id', $document->type_document_id)->first();
         if ($actual_document->master_id == 1) {
             $id_documento = $actual_document->id;
         }
     }
     $invoice->setJavascript($id_documento);
     $invoice->logo = 1;
     //$invoice->sfc = $branch->sfc;
     if ($account->currency_id == 1) {
         $invoice->sfc = 1;
     } else {
         $invoice->sfc = $account->exchange;
     }
     $invoice->qr = $invoice->account_nit . '|' . $invoice->invoice_number . '|' . $invoice->number_autho . '|' . $invoice->invoice_date . '|' . $invoice->importe_neto . '|' . $invoice->importe_total . '|' . $invoice->client_nit . '|' . $invoice->importe_ice . '|0|0|' . $invoice->descuento_total;
     if ($account->is_uniper) {
         $invoice->account_uniper = $account->uniper;
     }
     //$invoice->logo = $type_document->logo;
     $invoice->save();
     //foreach ($factura['products']  as $producto)
     //{
     $product = Product::where('account_id', Auth::user()->account_id)->where('product_key', $factura['code'])->first();
     if ($product != null) {
         $invoiceItem = InvoiceItem::createNew();
         $invoiceItem->setInvoice($invoice->id);
         $invoiceItem->setProduct($product->id);
         $invoiceItem->setProductKey($product->product_key);
         $invoiceItem->setNotes($product->notes);
         //$invoiceItem->setCost($factura['total']);
         $invoiceItem->setCost($factura['total']);
         $invoiceItem->setQty($factura['qty']);
         $invoiceItem->save();
     }
     // $this->sendInvoiceByMailLocal($client->name,$client->business_name,$invoice->id,$invoice->invoice_date,$client->nit);
     //}
 }