Available Budget amount

This commit is contained in:
venbatechnologies@gmail.com 2017-07-12 18:15:35 +05:30
parent abe7cf136c
commit 2ddca95cb0
4 changed files with 37 additions and 11 deletions

View File

@ -191,6 +191,16 @@ class purchaseorder extends BaseController
$data['INRSYMBOL']=$this->purchaseorder_model->GetINRCurrencytype('INR');
//print_r($data['INRSYMBOL']);
$AvlimportBudget = $this->purchaseorder_model->GetAvailableImportBudgetAmount($CostCode,$Year,$ReqType);
print_r($AvlimportBudget);
if(count($AvlimportBudget)>0)
{
$data['AvlimportBudAmt'] = $AvlimportBudget[0]['BudgetAmount'] - $AvlimportBudget[0]['TotalValue'];
}
// $data[$Rate->ExchangeRate]=$Rate->ExchangeRate;
//$data['CurrencyDetail']=$this->purchaseorder_model->GetCurrencyDetail($Currency);
@ -350,14 +360,16 @@ class purchaseorder extends BaseController
}
else if($ReqType == IMPORT)
{
$AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$Year,$ReqType);
$AvlBudget = $this->purchaseorder_model->GetAvailableImportBudgetAmount($CostCode,$Year,$ReqType);
//print_r($AvlBudget);
if(count($AvlBudget)>0)
{
$data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue'];
$data['AvlBudAmt'] = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['TotalValue'];
}
// print_r($data);
//print_r($data['AvlBudAmt']);
$data['POItem'] = $this->purchaseorder_model->GetImportPurchaseOrderDetails($PONO);
$data['Currency']=$this->purchaseorder_model->GetCurrencytype();
foreach($data['POMaster'] as $CUR)

View File

@ -188,10 +188,23 @@ function purchaseorderListing($forwhat='')
from T_CostCenter_Budget Bud where Bud.CostCenterCode=? and
BudgetYear = ? and BudgetType =?';
$query = $this->db->query($subQuery,array($CostCode,$BudgetType,$CostCode,$Year,$BudgetType));
$query = $this->db->query($subQuery,array($CostCode,$BudgetType,$CostCode,$Year,$BudgetType));
//print_r($this->db->last_query());
return $query->result_array();
}
function GetAvailableImportBudgetAmount($CostCode,$Year,$BudgetType)
{
$subQuery='select BudgetAmount,(select ifnull(sum((Quantity*Rate*ExchangeRate)),0)as TValue from T_PurchaseOrder_LineItem LineItem
join T_PurchaseOrder_Master Mast on Mast.PONO=LineItem.PONO where POType=?
and CostCenterCode=?)as TotalValue from T_CostCenter_Budget Bud where Bud.CostCenterCode=? and BudgetYear=? and BudgetType=?';
$query = $this->db->query($subQuery,array($BudgetType,$CostCode,$CostCode,$Year,$BudgetType));
//print_r($this->db->last_query());
return $query->result_array();
}
/**
@ -692,8 +705,8 @@ function GetImportPurchaseOrderDetails($PONO = '')
{
$subQuery ='SELECT distinct LineItem.LineItemNo,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName,
Mat.UOM,Quantity,Rate,Req.Status,ROUND((Quantity *Rate),2 ) as BasicValue,ActualQuantityReceived,
QuantityRejected,ROUND(ActualQuantityReceived-QuantityRejected)as PendingQty,
Mat.UOM,Quantity,Rate,Req.Status,ROUND((Quantity *Rate),2 ) as BasicValue,ReceivedQuantity,
QuantityRejected,ROUND(ReceivedQuantity-QuantityRejected)as PendingQty,
ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,POMast.ExchangeRate,AfterLandingCharge,AfterHighSeasSalesCharge,AfterCustomDuty,AfterExciseDuty,AfterExciseDutyEdCess,AddlExciseDuty,AfterAddlExciseDuty,Grossdutypayable,AvailableModvat,Grossexpensesduetocustomduty,purchaseratePerKG,CustomDutyExpensesPerKG,RMCIncludingCustomersPerKG,QuantityKG,BasicPriceInMTon,ProductPrice,CustomSHCess,AfterCustomSHCess,AfterExciseDutySHCess,ExciseDutySHCess,AfterCustomEdCess,ROUND((Quantity *Rate)+(RMCIncludingCustomersPerKG*Quantity),2)as TotalOrderValue,ROUND((POMast.ExchangeRate*BasicPriceInMTon),2) as BasicINRValue,TotalValue,CurrencyType,ReceivedQuantity,
Req.CostCenterCode,Dept.DepartmentName FROM T_PurchaseOrder_LineItem LineItem

View File

@ -1803,7 +1803,7 @@ if($PONOStatus == PO_RELEASED)
<div class="form-group">
<?php
$data = array('name' => 'ViewExchangeRt','value' => set_value('ViewExchangeRt'),'id'=>'ViewExchangeRt', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);','readonly'=>'true');
$data = array('name' => 'ViewExchangeRt','value' => set_value('ViewExchangeRt',$ExchangeRate),'id'=>'ViewExchangeRt', 'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);','readonly'=>'true');
echo form_input($data);
?>
</div>
@ -2224,7 +2224,7 @@ if($PONOStatus == PO_RELEASED)
<td><?php echo $record->UOM ?></td>
<td><?php echo $record->Rate ?></td>
<td><?php echo $record->BasicValue ?></td>
<td><?php echo $record->ActualQuantityReceived ?></td>
<td><?php echo $record->ReceivedQuantity ?></td>
<td><?php echo $record->QuantityRejected ?></td>
<td><?php echo $record->PendingQty?></td>
<!-- <td><?php echo $record->Taxamount?></td>
@ -3916,6 +3916,7 @@ $("#viewimportmodal").on("shown.bs.modal", function(e) {
$('#ViewItemName').val($('#materialName'+userid).val());
$('#ViewUOM').val($('#uom'+userid).val());
$('#ViewQuantity').val($('#quantity'+userid).val());
//$('#ViewExchangeRt').val($('#'))
//RequistQuantity = $('#quantity'+userid).val();
$('#ViewRate').val($('#itemRate'+userid).val());
$('#ViewtxtBasicValue').val($('#ProductPrice'+userid).val());

View File

@ -30,10 +30,10 @@ if(!empty($MaxPODate))
}
}
if(!empty($AvlBudAmt))
if(!empty($AvlimportBudAmt))
{
$AvlAmount = $AvlBudAmt;
$AvlAmount = $AvlimportBudAmt;
}
?>
@ -1810,7 +1810,7 @@ $("#txtBasicValue").val('');
var y = <?php echo json_encode($RequistionDetails, JSON_PRETTY_PRINT) ?>;
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
var AvlBudAmt = '<?php echo $AvlAmount ?>';
var AvlBudAmt = '<?php echo $AvlimportBudAmt ?>';
//alert(Material);
// For Binding DepartmentName