Fix
This commit is contained in:
@@ -16,6 +16,11 @@ class Project extends BaseModel {
|
|||||||
return $this->hasMany( 'Offer' );
|
return $this->hasMany( 'Offer' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function offer()
|
||||||
|
{
|
||||||
|
return $this->hasOne( 'Offer' );
|
||||||
|
}
|
||||||
|
|
||||||
public function projectemployees()
|
public function projectemployees()
|
||||||
{
|
{
|
||||||
return $this->hasMany( 'Projectemployee' );
|
return $this->hasMany( 'Projectemployee' );
|
||||||
@@ -105,10 +110,7 @@ class Project extends BaseModel {
|
|||||||
'projectleader' => function ( $q ) {
|
'projectleader' => function ( $q ) {
|
||||||
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
|
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
|
||||||
}] )
|
}] )
|
||||||
->with( [
|
->with( 'offer' )
|
||||||
'offers' => function ( $q ) {
|
|
||||||
$q->whereArchive( 'F' );
|
|
||||||
}] )
|
|
||||||
->with( [
|
->with( [
|
||||||
'projectemployees.user' => function ( $q ) {
|
'projectemployees.user' => function ( $q ) {
|
||||||
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
|
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
|
||||||
|
|||||||
@@ -804,7 +804,6 @@ $( function () {
|
|||||||
vm.projectnumber( data.projectnumber );
|
vm.projectnumber( data.projectnumber );
|
||||||
vm.projectname( data.projectname );
|
vm.projectname( data.projectname );
|
||||||
vm.vat_id( data.vat_id );
|
vm.vat_id( data.vat_id );
|
||||||
vm.totalRevenues( dbo.helpers.numberWithPoints( Math.round( Number( data.invoiceDetails.totalrevenue ) ) ) );
|
|
||||||
vm.totalRevenuesIncl( dbo.helpers.numberWithPoints( totalRevenuesIncl ) );
|
vm.totalRevenuesIncl( dbo.helpers.numberWithPoints( totalRevenuesIncl ) );
|
||||||
vm.totalInvoiced( dbo.helpers.numberWithPoints( Math.round( Number( data.invoiceDetails.totalinvoiced ) ) ) );
|
vm.totalInvoiced( dbo.helpers.numberWithPoints( Math.round( Number( data.invoiceDetails.totalinvoiced ) ) ) );
|
||||||
vm.outstanding( dbo.helpers.numberWithPoints( Math.round( Number( totalRevenuesIncl ) ) - Math.round( Number( data.invoiceDetails.totalinvoiced ) ) ) );
|
vm.outstanding( dbo.helpers.numberWithPoints( Math.round( Number( totalRevenuesIncl ) ) - Math.round( Number( data.invoiceDetails.totalinvoiced ) ) ) );
|
||||||
@@ -814,6 +813,14 @@ $( function () {
|
|||||||
|
|
||||||
vm.projectEmployees.removeAll();
|
vm.projectEmployees.removeAll();
|
||||||
vm.projecthours.removeAll();
|
vm.projecthours.removeAll();
|
||||||
|
|
||||||
|
vm.ownRevenue( dbo.helpers.numberWithPoints( Math.round( Number( data.offer.own_revenue ) ) ) );
|
||||||
|
vm.otherRevenue( dbo.helpers.numberWithPoints( Math.round( Number( data.offer.other_revenue ) ) ) );
|
||||||
|
vm.costs(dbo.helpers.numberWithPoints( Math.round( Number( data.offer.costs ) ) ) );
|
||||||
|
var revenues = Number(data.offer.own_revenue) + Number(data.offer.other_revenue) + Number(data.offer.costs);
|
||||||
|
vm.totalRevenues( dbo.helpers.numberWithPoints( Math.round( revenues ) ) );
|
||||||
|
|
||||||
|
|
||||||
_.each( data.projectemployees, function ( p ) {
|
_.each( data.projectemployees, function ( p ) {
|
||||||
vm.projectEmployees.push( new vm.Projectemployee( p ) );
|
vm.projectEmployees.push( new vm.Projectemployee( p ) );
|
||||||
} );
|
} );
|
||||||
@@ -830,16 +837,6 @@ $( function () {
|
|||||||
vm.projectcosts.push( new vm.Projectcost( p ) );
|
vm.projectcosts.push( new vm.Projectcost( p ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
vm.offers.removeAll();
|
|
||||||
_.each( data.offers, function ( p, i ) {
|
|
||||||
if ( i == 0 ) {
|
|
||||||
vm.ownRevenue( dbo.helpers.numberWithPoints( Math.round( Number( p.own_revenue ) ) ) );
|
|
||||||
vm.otherRevenue( dbo.helpers.numberWithPoints( Math.round( Number( p.other_revenue ) ) ) )
|
|
||||||
vm.costs(dbo.helpers.numberWithPoints( Math.round( Number( p.costs ) ) ) )
|
|
||||||
}
|
|
||||||
vm.offers.push( new dbo.offersService.Offer( p ) );
|
|
||||||
} );
|
|
||||||
|
|
||||||
vm.invoices.removeAll();
|
vm.invoices.removeAll();
|
||||||
_.each( data.invoices, function ( p ) {
|
_.each( data.invoices, function ( p ) {
|
||||||
vm.invoices.push( new vm.Invoice( p ) );
|
vm.invoices.push( new vm.Invoice( p ) );
|
||||||
|
|||||||
Reference in New Issue
Block a user