-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mauroziux
committed
Nov 5, 2015
1 parent
8c68737
commit 6f6a1ad
Showing
15 changed files
with
831 additions
and
247 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class egresos extends Model | ||
{ | ||
// | ||
//busco la tabla egresos | ||
public function getTable() | ||
{ | ||
//return Session::get('tenant.id').'_egresos'; | ||
return 'egresos'; | ||
} | ||
|
||
protected $fillable = [ | ||
'column1', | ||
'column1' | ||
|
||
]; | ||
public function formas_pago() | ||
{ | ||
return $this->belongsTo('App\formas_pago', 'formas_pago_id'); | ||
} | ||
|
||
|
||
public static function egresoXcompra($request, $id, $caja_id) | ||
{ | ||
$total = 0; | ||
foreach ($request->pagos as $pago) { | ||
$egreso = new egresos(); | ||
$egreso->compra_id = $id; | ||
$egreso->formas_pago_id = $pago['id']; | ||
$egreso->valor = $pago['valor']; | ||
$egreso->save(); | ||
$total += $pago['valor']; | ||
} | ||
$compra = compras::find($id); | ||
$compra->pagado = $compra->pagado + $total; | ||
$compra->save(); | ||
caja::EgresoXfactura($request->pagos,$caja_id,$compra->factura); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class Egresos extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
// | ||
Schema::create('egresos', function(Blueprint $table) | ||
{ | ||
$table->increments('id'); | ||
$table->integer('compra_id')->nullable(); | ||
$table->integer('gasto_id')->nullable(); | ||
$table->integer('formas_pago_id')->nullable(); | ||
$table->decimal('valor',16,2); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
// | ||
Schema::drop('egresos'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* Created by userpc on 4/11/2015. | ||
*/ | ||
var i = 0 | ||
var j = 0 | ||
function abrir_pagos(e) { | ||
|
||
event.preventDefault(); // para FF standard | ||
event.returnValue=false; // para IE | ||
$('#pagos').modal('show'); | ||
var valor = $('#pagar').data('pago'); | ||
$('#total-pago').html('0') | ||
$('#faltante').html(valor) | ||
$('#PAGAR').prop('disabled', true); | ||
|
||
} | ||
|
||
function totalpago() { | ||
var total = $('#pagar').data('pago'); | ||
var faltante | ||
var suma = 0 | ||
$('.pagoitem').each(function () { | ||
suma += parseInt($(this).val()) | ||
}) | ||
faltante = total - suma | ||
$('#total-pago').html(suma) | ||
$('#faltante').html(faltante) | ||
$('#PAGAR').prop('disabled', false); | ||
|
||
|
||
} | ||
|
||
function Adpago(pago, id) { | ||
valor = document.getElementById("faltante").innerText | ||
item = '<tr class="success" id="' + j + '"><td><input type="text" name="pagos[' + j + '][pago]" value="' + pago + | ||
'" class="pago font-w600" readonly></td>' + '<td width="40%"><input type="text" name="pagos[' + j + '][valor]" value="' + | ||
valor + '" class="pago pagoitem" onchange="totalpago()" ></td>' + | ||
'<td><input type="hidden" name="pagos[' + j + '][id]" value="' + id + '"></td>' + | ||
'<td><a class="btn btn-danger btn-xs" href="#" onclick="eliminar_pago(' + j + ')" role="button">' + | ||
'<span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a></td></tr>' | ||
$('#pagos-item').append(item) | ||
totalpago() | ||
j++ | ||
} | ||
|
||
function eliminar_pago(id) { | ||
$('#pagos-item').find('#' + id).html('') | ||
totalpago() | ||
} |
Oops, something went wrong.