diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php
index f8f881c8..24a50bb4 100644
--- a/application/controllers/purchaseorder.php
+++ b/application/controllers/purchaseorder.php
@@ -1054,9 +1054,8 @@ class purchaseorder extends BaseController
/**
* To stored new values after edited Revenue datas.
*/
- function EditRevenuePurchaseOrder()
+ function EditRevenuePurchaseOrder()
{
-
$PONO =$this->input->post('txtPONO');
$POdt =$this->input->post('PODate');
$PODate = $this->getDateformat($POdt);
@@ -1067,7 +1066,6 @@ class purchaseorder extends BaseController
$DeliveryAddr = $this->input->post('txtDeliveryAddress');
$dt = $this->input->post('Deliverydt');
-
$DeliveryOption = $this->input->post('DateRange');
if($DeliveryOption==1){
$Deliverydt = '';
@@ -1097,15 +1095,17 @@ class purchaseorder extends BaseController
$POType = $this->input->post('POType');
$PoRange = $this->input->post('txtPoRange');
+
$BudgetType = $this->input->post('Budget');
+
$SpcialInstruction = $this->input->post('SpcialInstruction');
$TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary');
$POStatus = $this->input->post('txtStatus');
+
$updatedBy = $this->session->userdata('userId');
$RowCount = $this->input->post('txtRowCount');
$DeletedRow = $this->input->post('txtDeletedRow');
-
$comma_separated = explode(':', $DeletedRow);
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$updateddt = $dt->format('Y-m-d H:i:s');
@@ -1118,15 +1118,14 @@ class purchaseorder extends BaseController
// PO Master
$POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'Status'=>$POStatus,'PORange'=>$Local_Interstate,'ServiceDescription'=>$SpcialInstruction,'UpdateBY'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$supplierreference,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Offer_No'=>$supplieroffno,'Other_Reference'=>$otherreference,'Fincap'=>$fincap,'InsuranceStatus'=>$insurancestatus,'POSubType'=>$revenuetype,'InsuranceNumber'=>$insuranceno,'IsQualityChkReqired'=>$Qualitycheck,'BudgetType'=>$BudgetType);
-
- $POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList);
-
+
+ $POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList);
+
$LineItemStatus = REQITEM_NEW;
if($PODate != $b4podate )
{
$logpo =array('PONO'=>$PONO,'LineItemNo'=>'-','UpdateBy'=>$updatedBy,'OldValue'=>$b4podate,'NewValue'=>$PODate,'Entity'=>'PO DateChanged');
-
-
+
$this->purchaseorder_model->insertlogpo($logpo);
}
@@ -1134,18 +1133,16 @@ class purchaseorder extends BaseController
{
if($newSupId[0] != $b4supplier)
{
-
+
$logpo =array('PONO'=>$PONO,'LineItemNo'=>'-','UpdateBy'=>$updatedBy,'OldValue'=>$b4supplier,'NewValue'=>$newsup,'Entity'=>'Supplier Changed');
-
-
- $this->purchaseorder_model->insertlogpo($logpo);
+ $this->purchaseorder_model->insertlogpo($logpo);
}
}
for ($i = 1; $i <= $RowCount; $i++)
{
-
+
$MaterialCode = $this->input->post('materialCode'.$i);
$Quantity = $this->input->post('quantity'.$i);
$Reqnumber = $this->input->post('Reqnumber'.$i);
@@ -1182,7 +1179,7 @@ class purchaseorder extends BaseController
if($Quantity != $b4qty)
{
$logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$updatedBy,'OldValue'=>$b4qty,'NewValue'=>$Quantity,'Entity'=>'Quantity Changed');
-
+
$this->purchaseorder_model->insertlogpo($logpo);
}
@@ -1195,6 +1192,7 @@ class purchaseorder extends BaseController
$this->purchaseorder_model->insertlogpo($logpo);
}
+
$SkipInsert = "False";
if( count($comma_separated) > 0)
{
@@ -1212,6 +1210,7 @@ class purchaseorder extends BaseController
}
+
$ReqDetails = array('Quantity'=>$Quantity,'UpdatedBy'=>$updatedBy,'UpdatedOn'=>$updateddt);
@@ -1224,35 +1223,47 @@ class purchaseorder extends BaseController
$recqty= $Quantity;
$IGRD= $this->purchaseorder_model->getIGRDetails($PONO);
+ $j = $i-1;
$IGRDs = array('QuantityAsPerInvoice'=>$Quantity,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt);
-
+
$this->purchaseorder_model->updateIGR($IGRD[$j]['IGRItemNo'],$IGRDs);
+ $itemNo = $IGRD[$j]['IGRItemNo'];
+
}
if($SkipInsert == "False")
{
+
+ if(strlen($POLineItemNo) == 0)
+ {
+
+ }
+ else
+ {
$LineItemNo = $POLineItemNo;
$POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'ReceivedQuantity'=>$recqty,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CostCenterCode'=>$CostCenter);
$POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$POLineItemNo,$POLineItemList);
-
+
+ }
$isExists = $this->purchaseorder_model->LineItemExistsinRevenueTax($LineItemNo);
-
- // $RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'NoOfTrip'=>$NOOfTrip);
- // $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList);
-
+ if(count($isExists) == 0)
+ {
+
+ }
+ else
+ {
$RevenueTaxList = array('DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'CreatedBy'=>$updatedBy,'NoOfTrip'=>$NOOfTrip);
-
$this->purchaseorder_model->updateRevenueTax($LineItemNo,$RevenueTaxList);
-
+
+ }
}
-
}
echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ;
@@ -1263,7 +1274,6 @@ class purchaseorder extends BaseController
*/
function pageNotFound()
{
- //$this->global['pageTitle'] = 'Resico : 404 - Page Not Found';
$this->global['pageTitle'] = $this->CompanyName.' : 404 - Page Not Found';
$this->loadViews("404", $this->global, NULL, NULL);
diff --git a/application/controllers/report.php b/application/controllers/report.php
index ec2bddd7..8b6ef133 100755
--- a/application/controllers/report.php
+++ b/application/controllers/report.php
@@ -513,7 +513,7 @@ class report extends BaseController
//print_r($prod);
$data['material']=$this->dahsboard_Model->material_name();
$data['cust']=$this->dahsboard_Model->customer_name();
- $data['finyear']=$this->dahsboard_Model->report_finyear();
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();
$data['purchase']=$this->dahsboard_Model->ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$cat);
}
$data['material']=$this->dahsboard_Model->material_name();
diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php
index aba28fb9..b84b20f0 100755
--- a/application/models/dahsboard_model.php
+++ b/application/models/dahsboard_model.php
@@ -72,19 +72,15 @@ $sql="select EmpID,CONCAT(FirstName,' ',LastName) as name FROM T_Employee_Detai
}
- function attyesterday($WH,$date)
+ function attyesterday($WH,$date)
{
- //echo 'model' . $WH.'-'.$date;
- // $sql="select EmpID,".$WH." from T_Attendance where Month_Year = ? and EmpID in (select EmpID from T_Attendance)" ;
-
-
-$sql="select att.EmpID,".$WH.",a.FirstName from T_Attendance as att
+
+$yes_date = date('Y-m-d',strtotime("-1 days"));
+$sql="select att.EmpID,ifnull(".$WH.",0)".$WH.",a.FirstName from T_Attendance as att
join T_Employee_Details as a on a.EmpID= att.EmpID
-where Month_Year = ? and att.EmpID in (select EmpID from T_Attendance)";
+where Month_Year = ? and att.EmpID in (select EmpID from T_Attendance) and date(a.Created_date) <= '".$yes_date."' and isActive=1";
$query = $this->db->query($sql,array($date));
- // print_r($query->result());
- //echo count($query->result());
- return $query->result_array();
+ return $query->result_array();
}
@@ -266,26 +262,36 @@ GROUP BY financial_year";
return $query->result();
}
+ function get_employee(){
+
+ $yes_date = date('Y-m-d',strtotime("-1 days"));
+ $sql = "select * from T_Employee_Details where date(created_date) <='".$yes_date."' and isActive =1";
+ $query = $this->db->query($sql);
+ return $query->result();
+}
function per($fa,$aa,$m)
{
- $sql= "SELECT year.Eid as Eid,year.ename as ename,year.active as active,month.days as days,month.Days_Worked as worked,month.percentage as percentage,year.days as yday,year.workd as yworkd,year.percentage as ypercentage
+ //echo $m;
+ $cur_month = date('M');
+ //echo $cur_month;
+ if($cur_month == $m ){
+
+ $cur_date = date('d');
+ }else{
+
+ $cur_date = date('t',strtotime($m));
+ }
+ //echo $cur_date;die;
+ $sql= "SELECT month.Eid as Eid,month.ename as ename,month.active as active,month.days as monthdays,month.Days_Worked as monthworked,month.percentage as monthpercentage
from (select em.EmpID as Eid,concat(em.FirstName,'.',em.LastName) as ename,em.IsActive as active,at.NoofDays as days,
-Days_Worked,round((Days_Worked/NoofDays*100)) as percentage from
+Days_Worked,round((Days_Worked/".$cur_date."*100)) as percentage from
T_Employee_Details em
join T_Attendance at on at.EmpID = em.EmpID
where (Month_Year >= '".$fa."-04-01' and Month_Year <= '".$aa."-04-01') and monthname(Month_Year) = '".$m."'
-) as month left join
-(select em.EmpID as Eid,concat(em.FirstName,'.',em.LastName) as ename,em.IsActive as active,sum(at.NoofDays) as days,
-sum(Days_Worked) workd,round((sum(Days_Worked)/sum(NoofDays)*100)) as percentage from
-T_Employee_Details em
-join T_Attendance at on at.EmpID = em.EmpID
-where (Month_Year >= '".$fa."-04-01' and Month_Year <= '".$aa."-04-01')
-group by Eid
-) as year on year.Eid = month.Eid and year.ename = month.ename
-group by Eid ";
+) as month";
$query = $this->db->query($sql);
- return $query->result();
+ return $query->result();
}
@@ -376,32 +382,6 @@ $query = $this->db->query($sql);
return $query->result();
}
- // function totalserviceamount()
- // {
- // $sql="select sum(BudgetAmount) as totalserviceamount from T_CostCenter_Budget where BudgetType='SERVICE'";
- // $query = $this->db->query($sql);
- // return $query->result();
-
- // }
- // function totalcapitalamount()
- // {
- // $sql="select sum(BudgetAmount) as totalcapitalamount from T_CostCenter_Budget where BudgetType='CAPITAL'";
- // $query = $this->db->query($sql);
- // return $query->result();
-// }
-// function totalimportamount()
- // {
- // $sql="select sum(BudgetAmount) as totalimportamount from T_CostCenter_Budget where BudgetType='IMPORT'";
- // $query = $this->db->query($sql);
- // return $query->result();
-// }
-// function totalrevenueamount()
- // {
- // $sql="select sum(BudgetAmount) as totalrevenueamount from T_CostCenter_Budget where BudgetType='REVENUE'";
- // $query = $this->db->query($sql);
- // return $query->result();
-// }
-//totalservice
function getTotalServicePoCount(){
$i=1;
if (date('m') >= 4)
@@ -1183,7 +1163,8 @@ group by supplier_name,material_name";
case pm.POType
when 'IMPORT'
-then ifnull((sum(distinct(pl.Quantity * pl.Rate) * pm.ExchangeRate)),0) + ifnull(rt.Insurance,0)
+then ifnull((sum(distinct(pl.Quantity * pl.Rate) * pm.ExchangeRate)
+),0) + ifnull(rt.Insurance,0)
when 'CAPITAL'
then sum(distinct if(pm.CapitalRange=0,(( pl.Quantity * pl.Rate) * pm.ExchangeRate),( pl.Quantity * pl.Rate)
- st.Afterdiscountval))
@@ -1492,7 +1473,7 @@ ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)))
sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
im.file as ifile,pb.FilePath as file
from T_IGR_Master im
-join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
+left join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
@@ -1551,61 +1532,28 @@ $sql.="group by pono,material_name,category,supplier_name,id.IGRItemNo";
$query = $this->db->query($sql);
return $query->result();
}
- function ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat,$da,$po){
+ function ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat,$da,$po){
- $sql="select im.IGRNO as igrn,pm.POType as potype,im.PONO as pono,date_format(im.CreatedDate,'%d-%m-%Y') as created_date,TIME_FORMAT(im.CreatedDate,'%l:%i %p') as created_time,mm.MaterialName as material_name,mm.Category as category,sd.SupplierName as supplier_name,mm.UOM as UOM, sum(id.QuantityAsPerInvoice) as quantity,pl.Rate as rate,round(sum(id.QuantityAsPerInvoice) * pl.Rate,2) as value,if(POType = 'IMPORT' or POType = 'CAPITAL',sum(pm.ExchangeRate),0) as exchange_rate,date_format(im.MaterialRcvdDate,'%d-%m-%Y') as materialrcvddate,
-round(ifnull(if(POType = 'REVENUE',
-sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
-sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) as sgst,
-round(ifnull(if(POType = 'REVENUE',
-sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
-sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2) as cgst,
-round(ifnull(if(POType = 'REVENUE',
-sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
-sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2) as igst,
-round(ifnull(if(POType = 'REVENUE',
-sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
-sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2) as discount,
-round(ifnull(if(POType = 'REVENUE',
-sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
-sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2) as freight,
-round(ifnull(if(POType = 'REVENUE',
-sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2) as Package,
-
-round((
-if(POType = 'IMPORT',sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
-if(POType = 'CAPITAL' && CapitalRange = 0,sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
-ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)))
-+ round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
- sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2)
-+ round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
- sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2)
-+ round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
- sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2)
-+ round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
- sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2)
-+ round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2)
-- round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
- sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
- im.file as ifile,pb.FilePath as file
-from T_IGR_Master im
-join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
-join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
-join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
-left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
-left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
-left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
-left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
-left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
-where pm.Status != 'ST030' ";
-
+ $sql ="select im.IGRNO as igrn,pm.POType as potype,im.PONO as pono,date_format(im.CreatedDate,'%d-%m-%Y') as created_date,TIME_FORMAT(im.CreatedDate,'%l:%i %p') as created_time,mm.MaterialName as material_name,mm.Category as category,sd.SupplierName as supplier_name,mm.UOM as UOM, id.QuantityAsPerInvoice as quantity,pl.Rate as rate,round(id.QuantityAsPerInvoice * pl.Rate,2) as value,if(POType = 'IMPORT' or POType = 'CAPITAL',pm.ExchangeRate,0) as exchange_rate,date_format(im.MaterialRcvdDate,'%d-%m-%Y') as materialrcvddate,
+ round(ifnull(if(POType = 'REVENUE',
+ (id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
+ (id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) as sgst, round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
+ (id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2) as cgst, round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
+ (id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2) as igst, round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
+ (id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2) as discount,
+ round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
+ (id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2) as freight,
+ round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2) as Package,
+
+ round(( if(POType = 'IMPORT',(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
+ if(POType = 'CAPITAL' && CapitalRange = 0,(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
+ ifnull((id.QuantityAsPerInvoice * pl.Rate),0))) + round(ifnull(if(POType = 'REVENUE',
+ (id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
+ (id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) + round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity), (id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2) + round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity), (id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2) + round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity), (id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2) + round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2) - round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity), (id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total, im.file as ifile,pb.FilePath as file from T_IGR_Master im join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
+
+ where pm.Status != 'ST030' ";
+
if ($cname!= ''){
$sql.="and sd.SupplierName = '".$cname."'";
@@ -1690,7 +1638,7 @@ $sql.="group by pono,material_name,category,supplier_name,id.IGRItemNo";
function ireport_attachment($cname,$fa,$aa,$m,$frm,$t){
- $sql="select pono,potype,date_format(created_date,'%d-%m-%Y') as created_date,date_format(materialrcvddate,'%d-%m-%Y') as materialrcvddate,supplier_name,
+ /** $sql="select pono,potype,date_format(created_date,'%d-%m-%Y') as created_date,date_format(materialrcvddate,'%d-%m-%Y') as materialrcvddate,supplier_name,
sum(total) as total,file,ifile
from igr
where status != 'ST030'
@@ -1700,9 +1648,25 @@ if ($cname!= ''){
$sql.="and supplier_name = '".$cname."'";
- }
-
+ }**/
+ $sql="select pm.Status AS status,sd.SupplierID AS sid,im.file AS ifile,pb.FilePath AS file,im.IGRNO AS igrn,pm.POType AS potype,im.PONO AS pono,date_format(im.CreatedDate,'%d-%m-%Y') AS created_date,time_format(im.CreatedDate,'%l:%i %p') AS created_time,mm.MaterialName AS material_name,
+date_format(im.MaterialRcvdDate,'%d-%m-%Y') as materialrcvddate,sd.SupplierName AS supplier_name,sum(id.QuantityAsPerInvoice) AS quantity,
+round(((((((if((pm.POType = 'IMPORT'),sum((pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate))),if(((pm.POType = 'CAPITAL') and (pm.CapitalRange = 0)),sum((pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate))),ifnull(sum((id.QuantityAsPerInvoice * pl.Rate)),0))) + round(ifnull(if((pm.POType = 'REVENUE'),sum(((id.QuantityAsPerInvoice * rt.AfterSGST) / pl.Quantity)),sum(((id.QuantityAsPerInvoice * st.After_SGST) / pl.Quantity))),0),2)) + round(ifnull(if((pm.POType = 'REVENUE'),sum(((id.QuantityAsPerInvoice * rt.AfterCGST) / pl.Quantity)),sum(((id.QuantityAsPerInvoice * st.After_CGST) / pl.Quantity))),0),2)) + round(ifnull(if((pm.POType = 'REVENUE'),sum(((id.QuantityAsPerInvoice * rt.AfterIGST) / pl.Quantity)),sum(((id.QuantityAsPerInvoice * st.After_IGST) / pl.Quantity))),0),2)) + round(ifnull(if((pm.POType = 'REVENUE'),sum(((id.QuantityAsPerInvoice * rt.AfterFreightValue) / pl.Quantity)),sum(((id.QuantityAsPerInvoice * st.AfterFreightValue) / pl.Quantity))),0),2)) + round(ifnull(if((pm.POType = 'REVENUE'),sum(((id.QuantityAsPerInvoice * rt.AfterPackagingValue) / pl.Quantity)),0),0),2)) - round(ifnull(if((pm.POType = 'REVENUE'),sum(((id.QuantityAsPerInvoice * rt.AfterDiscount) / pl.Quantity)),sum(((id.QuantityAsPerInvoice * st.Afterdiscountval) / pl.Quantity))),0),2)),2) AS total
+from ((((((((T_IGR_Master im join T_PurchaseOrder_LineItem pl on((pl.PONO = im.PONO))) join T_IGR_Details id on(((id.IGRNO = im.IGRNO) and (id.MaterialCode = pl.MaterialCode)))) join T_PurchaseOrder_Master pm on((pm.PONO = pl.PONO)))
+left join T_MaterialMaster mm on((mm.MaterialCode = pl.MaterialCode)))
+left join T_SupplierDetailsN sd on((sd.SupplierID = pm.SupplierID)))
+left join T_Service_Tax st on((st.LineItemNo = pl.LineItemNo)))
+left join T_Revenue_Tax rt on((rt.LineItemNo = pl.LineItemNo)))
+left join T_PurchaseOrder_BillUpload pb on((pb.PONO = im.PONO)))
+where (pm.Status <> 'ST030') ";
+
+
+ if ($cname!= ''){
+
+ $sql.="and sd.SupplierName = '".$cname."'";
+
+ }
if ($fa and $aa != ''){
@@ -1745,7 +1709,7 @@ if ($cname!= ''){
// group by month(CreatedDate)
// ";
//echo $sql;
- $sql="select dat as CreatedDate,materialrcvddate,sum(quantity)as quantity,sum(value) as value,materialrcvddate
+ $sql="select materialrcvddate,sum(quantity)as quantity,sum(value) as value,materialrcvddate
from year_inward
where status != 'ST030' and date(materialrcvddate) >= '$a-04-01' and date(materialrcvddate) <= '$b-03-31'
group by month(materialrcvddate)";
@@ -1879,31 +1843,31 @@ if ($cname!= ''){
$sql="select sid,mid,supplier_name,material_name,
- SUM(IF(month(dat) = 4, quantity, 0)) AS April,
- SUM(IF(month(dat) = 5, quantity, 0)) AS May,
- SUM(IF(month(dat) = 6, quantity, 0)) AS June,
- SUM(IF(month(dat) = 7, quantity, 0)) AS July,
- SUM(IF(month(dat) = 8, quantity, 0)) AS August,
- SUM(IF(month(dat) = 9, quantity, 0)) AS September,
- SUM(IF(month(dat) = 10, quantity, 0)) AS October,
- SUM(IF(month(dat) = 11, quantity, 0)) AS November,
- SUM(IF(month(dat) = 12, quantity, 0)) AS December,
- SUM(IF(month(dat) = 1, quantity, 0)) AS January,
- SUM(IF(month(dat) = 2, quantity, 0)) AS February,
- SUM(IF(month(dat) = 3, quantity, 0)) AS March,
- sum(quantity) as qtotal,
- SUM(IF(month(dat) = 4, value, 0)) AS vApril,
- SUM(IF(month(dat) = 5, value, 0)) AS vMay,
- SUM(IF(month(dat) = 6, value, 0)) AS vJune,
- SUM(IF(month(dat) = 7, value, 0)) AS vJuly,
- SUM(IF(month(dat) = 8, value, 0)) AS vAugust,
- SUM(IF(month(dat) = 9, value, 0)) AS vSeptember,
- SUM(IF(month(dat) = 10, value, 0)) AS vOctober,
- SUM(IF(month(dat) = 11, value, 0)) AS vNovember,
- SUM(IF(month(dat) = 12, value, 0)) AS vDecember,
- SUM(IF(month(dat) = 1, value, 0)) AS vJanuary,
- SUM(IF(month(dat) = 2, value, 0)) AS vFebruary,
- SUM(IF(month(dat) = 3, value, 0)) AS vMarch,
+ SUM(IF(month(materialrcvddate) = 4, quantity, 0)) AS April,
+ SUM(IF(month(materialrcvddate) = 5, quantity, 0)) AS May,
+ SUM(IF(month(materialrcvddate) = 6, quantity, 0)) AS June,
+ SUM(IF(month(materialrcvddate) = 7, quantity, 0)) AS July,
+ SUM(IF(month(materialrcvddate) = 8, quantity, 0)) AS August,
+ SUM(IF(month(materialrcvddate) = 9, quantity, 0)) AS September,
+ SUM(IF(month(materialrcvddate) = 10, quantity, 0)) AS October,
+ SUM(IF(month(materialrcvddate) = 11, quantity, 0)) AS November,
+ SUM(IF(month(materialrcvddate) = 12, quantity, 0)) AS December,
+ SUM(IF(month(materialrcvddate) = 1, quantity, 0)) AS January,
+ SUM(IF(month(materialrcvddate) = 2, quantity, 0)) AS February,
+ SUM(IF(month(materialrcvddate) = 3, quantity, 0)) AS March,
+ sum(quantity) as qtotal,
+ SUM(IF(month(materialrcvddate) = 4, value, 0)) AS vApril,
+ SUM(IF(month(materialrcvddate) = 5, value, 0)) AS vMay,
+ SUM(IF(month(materialrcvddate) = 6, value, 0)) AS vJune,
+ SUM(IF(month(materialrcvddate) = 7, value, 0)) AS vJuly,
+ SUM(IF(month(materialrcvddate) = 8, value, 0)) AS vAugust,
+ SUM(IF(month(materialrcvddate) = 9, value, 0)) AS vSeptember,
+ SUM(IF(month(materialrcvddate) = 10, value, 0)) AS vOctober,
+ SUM(IF(month(materialrcvddate) = 11, value, 0)) AS vNovember,
+ SUM(IF(month(materialrcvddate) = 12, value, 0)) AS vDecember,
+ SUM(IF(month(materialrcvddate) = 1, value, 0)) AS vJanuary,
+ SUM(IF(month(materialrcvddate) = 2, value, 0)) AS vFebruary,
+ SUM(IF(month(materialrcvddate) = 3, value, 0)) AS vMarch,
sum(value) as vtotal
FROM year_inward
where status != 'ST030' ";
@@ -2111,32 +2075,32 @@ if ($cname!= ''){
function rawi_report_consolidate($cname,$fa,$aa){
- $sql="select sid,mid,category,supplier_name,material_name,
- SUM(IF(month(dat) = 4, quantity, 0)) AS April,
- SUM(IF(month(dat) = 5, quantity, 0)) AS May,
- SUM(IF(month(dat) = 6, quantity, 0)) AS June,
- SUM(IF(month(dat) = 7, quantity, 0)) AS July,
- SUM(IF(month(dat) = 8, quantity, 0)) AS August,
- SUM(IF(month(dat) = 9, quantity, 0)) AS September,
- SUM(IF(month(dat) = 10, quantity, 0)) AS October,
- SUM(IF(month(dat) = 11, quantity, 0)) AS November,
- SUM(IF(month(dat) = 12, quantity, 0)) AS December,
- SUM(IF(month(dat) = 1, quantity, 0)) AS January,
- SUM(IF(month(dat) = 2, quantity, 0)) AS February,
- SUM(IF(month(dat) = 3, quantity, 0)) AS March,
- sum(quantity) as qtotal,
- SUM(IF(month(dat) = 4, value, 0)) AS vApril,
- SUM(IF(month(dat) = 5, value, 0)) AS vMay,
- SUM(IF(month(dat) = 6, value, 0)) AS vJune,
- SUM(IF(month(dat) = 7, value, 0)) AS vJuly,
- SUM(IF(month(dat) = 8, value, 0)) AS vAugust,
- SUM(IF(month(dat) = 9, value, 0)) AS vSeptember,
- SUM(IF(month(dat) = 10, value, 0)) AS vOctober,
- SUM(IF(month(dat) = 11, value, 0)) AS vNovember,
- SUM(IF(month(dat) = 12, value, 0)) AS vDecember,
- SUM(IF(month(dat) = 1, value, 0)) AS vJanuary,
- SUM(IF(month(dat) = 2, value, 0)) AS vFebruary,
- SUM(IF(month(dat) = 3, value, 0)) AS vMarch,
+ $sql="select sid,mid,category,supplier_name,material_name,
+ SUM(IF(month(materialrcvddate) = 4, quantity, 0)) AS April,
+ SUM(IF(month(materialrcvddate) = 5, quantity, 0)) AS May,
+ SUM(IF(month(materialrcvddate) = 6, quantity, 0)) AS June,
+ SUM(IF(month(materialrcvddate) = 7, quantity, 0)) AS July,
+ SUM(IF(month(materialrcvddate) = 8, quantity, 0)) AS August,
+ SUM(IF(month(materialrcvddate) = 9, quantity, 0)) AS September,
+ SUM(IF(month(materialrcvddate) = 10, quantity, 0)) AS October,
+ SUM(IF(month(materialrcvddate) = 11, quantity, 0)) AS November,
+ SUM(IF(month(materialrcvddate) = 12, quantity, 0)) AS December,
+ SUM(IF(month(materialrcvddate) = 1, quantity, 0)) AS January,
+ SUM(IF(month(materialrcvddate) = 2, quantity, 0)) AS February,
+ SUM(IF(month(materialrcvddate) = 3, quantity, 0)) AS March,
+ sum(quantity) as qtotal,
+ SUM(IF(month(materialrcvddate) = 4, value, 0)) AS vApril,
+ SUM(IF(month(materialrcvddate) = 5, value, 0)) AS vMay,
+ SUM(IF(month(materialrcvddate) = 6, value, 0)) AS vJune,
+ SUM(IF(month(materialrcvddate) = 7, value, 0)) AS vJuly,
+ SUM(IF(month(materialrcvddate) = 8, value, 0)) AS vAugust,
+ SUM(IF(month(materialrcvddate) = 9, value, 0)) AS vSeptember,
+ SUM(IF(month(materialrcvddate) = 10, value, 0)) AS vOctober,
+ SUM(IF(month(materialrcvddate) = 11, value, 0)) AS vNovember,
+ SUM(IF(month(materialrcvddate) = 12, value, 0)) AS vDecember,
+ SUM(IF(month(materialrcvddate) = 1, value, 0)) AS vJanuary,
+ SUM(IF(month(materialrcvddate) = 2, value, 0)) AS vFebruary,
+ SUM(IF(month(materialrcvddate) = 3, value, 0)) AS vMarch,
sum(value) as vtotal
FROM year_inward
where status != 'ST030' ";
diff --git a/application/views/Report_consolidate_month_inward.php b/application/views/Report_consolidate_month_inward.php
index 116655c0..7c16b661 100755
--- a/application/views/Report_consolidate_month_inward.php
+++ b/application/views/Report_consolidate_month_inward.php
@@ -1,4 +1,3 @@
-