Skip to content

Commit

Permalink
Completed refactoring of Grain Storage Loan
Browse files Browse the repository at this point in the history
  • Loading branch information
jongravois committed Mar 10, 2015
1 parent da76795 commit 81cf9ec
Show file tree
Hide file tree
Showing 1,025 changed files with 83,258 additions and 489 deletions.
4 changes: 2 additions & 2 deletions app/Acme/Transformers/CommentTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ public function transform($arr)
{
//return $arr;
return [
'id' =>$arr['id'],
'id' =>$arr['id'],
'loan_id' => $arr['loan_id'],
'type' => $arr['type'],
'user_id' => $arr['user_id'],
'user' => $arr['user']['username'],
'dtCom' => $arr['created_at']->format('m/d/Y'),
'comment' => $arr['comment'],
'responses' => $arr['responses'],
'status' => $arr['status']
'status' => $arr['status']
];
}
}
71 changes: 35 additions & 36 deletions app/Acme/Transformers/LoancropTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,43 @@ public function transform($arr)
{
//return $arr;

if( is_null($arr['p1_yield'])){
$p1 = null;
} else {
$p1 = (double) $arr['p1_yield'];
}
if( is_null($arr['p1_yield'])){
$p1 = null;
} else {
$p1 = (double) $arr['p1_yield'];
}

if( is_null($arr['p2_yield'])){
$p2 = null;
} else {
$p2 = (double) $arr['p2_yield'];
}
if( is_null($arr['p2_yield'])){
$p2 = null;
} else {
$p2 = (double) $arr['p2_yield'];
}

if( is_null($arr['p3_yield'])){
$p3 = null;
} else {
$p3 = (double) $arr['p3_yield'];
}
if( is_null($arr['p3_yield'])){
$p3 = null;
} else {
$p3 = (double) $arr['p3_yield'];
}

if( is_null($arr['p4_yield'])){
$p4 = null;
} else {
$p4 = (double) $arr['p4_yield'];
}
if( is_null($arr['p4_yield'])){
$p4 = null;
} else {
$p4 = (double) $arr['p4_yield'];
}

if( is_null($arr['p5_yield'])){
$p5 = null;
} else {
$p5 = (double) $arr['p5_yield'];
}
if( is_null($arr['p5_yield'])){
$p5 = null;
} else {
$p5 = (double) $arr['p5_yield'];
}

if( is_null($arr['p6_yield'])){
$p6 = null;
} else {
$p6 = (double) $arr['p6_yield'];
}
if( is_null($arr['p6_yield'])){
$p6 = null;
} else {
$p6 = (double) $arr['p6_yield'];
}

return [
return [
'id' => (integer) $arr['id'],
'crop_year' => (integer) $arr['crop_year'],
'crop_id' => $arr['crop']['id'],
Expand All @@ -64,18 +64,17 @@ public function transform($arr)
'harvest' => (double) $arr['harvest'],
'rebates' => (double) $arr['rebates'],
'fsa_payment' => (double) $arr['fsa_payment'],
'percent_irrigated' => $arr['percent_irrigated'],
'percent_irrigated' => (double) $arr['percent_irrigated'],
'break_even' => $arr['break_even'],
'p1_yield' => $p1,
'p2_yield' => $p2,
'p3_yield' => $p3,
'p4_yield' => $p4,
'p5_yield' => $p5,
'p6_yield' => $p6,
'arm_default_price' => (double) $arr['crop']['arm_default_price'],
'arm_default_ins_price' => (double) $arr['crop']['arm_default_ins_price'],
'arm_default_yield' => (double) $arr['crop']['arm_default_yield'],
'percent_irrigated' => $arr['crop']['percent_irrigated'],
'arm_default_price' => (double) $arr['crop']['arm_default_price'],
'arm_default_ins_price' => (double) $arr['crop']['arm_default_ins_price'],
'arm_default_yield' => (double) $arr['crop']['arm_default_yield'],
'adj_prod' => ((double) $arr['acres'] * ((double) $arr['prod_share']/100) * (double) $arr['prod_yield'] * (double) $arr['prod_price'])+(((double) $arr['bkprice'] - (double) $arr['prod_price']) * (double) $arr['harvest']) - ((double) $arr['harvest'] * ((double) $arr['prod_yield']/100) * (double) $arr['acres']) + ((double) $arr['rebates'] * (double) $arr['prod_yield'] * ((double) $arr['prod_share']/100) * (double) $arr['acres'])
];
}
Expand Down
3 changes: 0 additions & 3 deletions app/Acme/Transformers/PdfAppTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ public function transform($arr)
'title' => $arr['title'],
'description' => $arr['description'],
'pdfLink' => $arr['pdfLink'],
'pdfImg' => $arr['pdfImg'],
'docLink' => $arr['docLink'],
'docImg' => $arr['docImg'],
'rank' => (integer) $arr['rank'],
'visible' => (boolean) $arr['isVisible']
];
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/LoansController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class LoansController extends ApiController {
function __construct(LoanTransformer $loanTransformer, NotificationTransformer $notificationTransformer, CommentTransformer $commentTransformer)
{
$this->loanTransformer = $loanTransformer;
$this->notificationTransformer = $notificationTransformer;
$this->notificationTransformer = $notificationTransformer;
$this->commentTransformer = $commentTransformer;

//$this->beforeFilter('auth.basic', ['on'=>'post']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ public function up()
$table->string('title');
$table->text('description');
$table->string('pdfLink');
$table->string('pdfImg');
$table->string('docLink');
$table->string('docImg');
$table->integer('rank');
$table->boolean('isVisible');
$table->boolean('isVisible')->default(1);
$table->timestamps();
});
}
Expand Down
48 changes: 16 additions & 32 deletions app/database/seeds/PdfAppsTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,31 @@ class PdfAppsTableSeeder extends Seeder
public function run()
{
PdfApp::create([
"title" => "Ag Input and All-In Loan Application",
"description" => "Production loans that are jointly handled between ARM and an input supplier. Production loan amounts can range up to $5 million.",
"pdfLink" => "",
"pdfImg" => "//nebula.wsimg.com/38a8fe14d4d345c41d0abd1e3545b5e9?AccessKeyId=D44466EADCCC527413A8&disposition=0&alloworigin=1",
"docLink" => "",
"docImg" => "//nebula.wsimg.com/a03ac4947772ea5cfec093fb15cd3e6e?AccessKeyId=D44466EADCCC527413A8&disposition=0&alloworigin=1",
"rank" => 0,
"isVisible" => true
'title' => 'Ag Input and All-In Loan Application',
'description' => 'Production loans that are jointly handled between ARM and an input supplier. Production loan amounts can range up to $5 million.',
'pdfLink' => 'Application_CropLoan.pdf',
'rank' => 0
]);

PdfApp::create([
"title" => "Grain Storage Loan Application",
"description" => "ARM will advance cash on grain that has been contracted and is in on-farm storage. Cash advances can be as much as 90% of the contract value. Loan repayment is determined by the delivery date of selling.",
"pdfLink" => "",
"pdfImg" => "//nebula.wsimg.com/38a8fe14d4d345c41d0abd1e3545b5e9?AccessKeyId=D44466EADCCC527413A8&disposition=0&alloworigin=1",
"docLink" => "",
"docImg" => "//nebula.wsimg.com/a03ac4947772ea5cfec093fb15cd3e6e?AccessKeyId=D44466EADCCC527413A8&disposition=0&alloworigin=1",
"rank" => 1,
"isVisible" => true
'title' => 'Grain Storage Loan Application',
'description' => 'ARM will advance cash on grain that has been contracted and is in on-farm storage. Cash advances can be as much as 90% of the contract value. Loan repayment is determined by the delivery date of selling.',
'pdfLink' => 'Application_GrainStorage.pdf',
'rank' => 1
]);

PdfApp::create([
"title" => "Capital Bridge Application",
"description" => "These are fall production loan that are determined by prior production costs. ARM will lend up to 25% of production needs. ARM works with a primary lender to set up an additional line of credit that allows for fall and early spring production finance needs. This loan may be acquired prior to the pay-off of previous crops production loan.",
"pdfLink" => "",
"pdfImg" => "//nebula.wsimg.com/38a8fe14d4d345c41d0abd1e3545b5e9?AccessKeyId=D44466EADCCC527413A8&disposition=0&alloworigin=1",
"docLink" => "",
"docImg" => "//nebula.wsimg.com/a03ac4947772ea5cfec093fb15cd3e6e?AccessKeyId=D44466EADCCC527413A8&disposition=0&alloworigin=1",
"rank" => 2,
"isVisible" => true
'title' => 'Capital Bridge Application',
'description' => 'These are fall production loan that are determined by prior production costs. ARM will lend up to 25% of production needs. ARM works with a primary lender to set up an additional line of credit that allows for fall and early spring production finance needs. This loan may be acquired prior to the pay-off of previous crops production loan.',
'pdfLink' => 'Application_CapitalBridge.pdf',
'rank' => 2
]);

PdfApp::create([
"title" => "Wheat Xpress Application",
"description" => "Quick and convenient wheat production financing.",
"pdfLink" => "",
"pdfImg" => "//nebula.wsimg.com/38a8fe14d4d345c41d0abd1e3545b5e9?AccessKeyId=D44466EADCCC527413A8&disposition=0&alloworigin=1",
"docLink" => "",
"docImg" => "//nebula.wsimg.com/a03ac4947772ea5cfec093fb15cd3e6e?AccessKeyId=D44466EADCCC527413A8&disposition=0&alloworigin=1",
"rank" => 3,
"isVisible" => true
'title' => 'Wheat Xpress Application',
'description' => 'Quick and convenient wheat production financing.',
'pdfLink' => 'Application_WheatXpress.pdf',
'rank' => 3
]);
}
}
27 changes: 12 additions & 15 deletions app/database/seeds/RequireddocumentsTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ public function run()
'loantype_id' => 6,
'document' => "Signed Application"
]);
Requireddocuments::create([
'loantype_id' => 7,
'document' => "Signed Application"
]);

Requireddocuments::create([
'loantype_id' => 7,
'document' => "Signed Application"
]);
Requireddocuments::create([
'loantype_id' => 1,
'document' => "Driver's License"
Expand All @@ -57,11 +56,10 @@ public function run()
'loantype_id' => 6,
'document' => "Driver's License"
]);
Requireddocuments::create([
'loantype_id' => 7,
'document' => "Driver's License"
]);

Requireddocuments::create([
'loantype_id' => 7,
'document' => "Driver's License"
]);
Requireddocuments::create([
'loantype_id' => 1,
'document' => "CPA Financials"
Expand All @@ -86,11 +84,10 @@ public function run()
'loantype_id' => 6,
'document' => "CPA Financials"
]);
Requireddocuments::create([
'loantype_id' => 7,
'document' => "CPA Financials"
]);

Requireddocuments::create([
'loantype_id' => 7,
'document' => "CPA Financials"
]);
Requireddocuments::create([
'loantype_id' => 1,
'document' => "Equipment List"
Expand Down
2 changes: 1 addition & 1 deletion app/models/PdfApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
class PdfApp extends \Eloquent
{
protected $table = 'pdfapps';
protected $fillable = ['title', 'description', 'pdfLink', 'pdfImg', 'docLink', 'docImg', 'rank', 'isVisible'];
protected $fillable = ['title', 'description', 'pdfLink', 'rank', 'isVisible'];
}
Loading

0 comments on commit 81cf9ec

Please sign in to comment.