diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 1b1667a7..4e380f05 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -420,9 +420,9 @@ $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_Material_Supplier', 'Re $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_Material_Item', 'Report::MM_Item'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_Material_ReceiptValue', 'Report::MM_ReceiptValue'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_purchase', 'Report::purchase'); -$routes->get('report/consolidate_month', 'Report::consolidate_month'); -$routes->get('report/link_purchase', 'Report::link_purchase'); -$routes->get('report/consolidate_year', 'Report::consolidate_year'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'report/consolidate_month', 'Report::consolidate_month'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'report/link_purchase', 'Report::link_purchase'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'report/consolidate_year', 'Report::consolidate_year'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_year_wise', 'Report::year_wise'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_supplier', 'Report::purchase_supplier'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_consolidate', 'Report::consolidate'); @@ -434,32 +434,35 @@ $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'cashbookmonthlyexpenses', 'Rep $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'cashbookyearlyexpenses', 'Report::yearexpenses'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_purchase_inward', 'Report::ipurchase'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_year_wise_inward', 'Report::iyear_wise'); -$routes->get('report/imonth_wise', 'Report::imonth_wise'); -$routes->get('report/iyear_wise_total/(:any)', 'Report::iyear_wise_total/$1'); -$routes->get('report/ilink_purchase', 'Report::ilink_purchase'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'report/imonth_wise', 'Report::imonth_wise'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'report/iyear_wise_total/(:any)', 'Report::iyear_wise_total/$1'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'report/ilink_purchase', 'Report::ilink_purchase'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_supplier_inward', 'Report::ipurchase_supplier'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_supplier_summary', 'Report::suppliersummary'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_consolidate_inward', 'Report::iconsolidate'); -$routes->get('report/i_consolidate_month', 'Report::i_consolidate_month'); -$routes->get('report/i_consolidate_year', 'Report::i_consolidate_year'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'report/i_consolidate_month', 'Report::i_consolidate_month'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'report/i_consolidate_year', 'Report::i_consolidate_year'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_cumulative_inward', 'Report::icumulative'); -$routes->get('report/icum_day/(:any)/(:any)', 'Report::icum_day/$1/$2'); -$routes->get('report/icum_month/(:any)/(:any)', 'Report::icum_month/$1/$2'); -$routes->get('report/icum_year/(:any)/(:any)', 'Report::icum_year/$1/$2'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'report/icum_day/(:any)/(:any)', 'Report::icum_day/$1/$2'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'report/icum_month/(:any)/(:any)', 'Report::icum_month/$1/$2'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'report/icum_year/(:any)/(:any)', 'Report::icum_year/$1/$2'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_cumulative_raw', 'Report::rawi_cumulative'); -$routes->get('report/rawi_cum_day', 'Report::rawi_cum_day'); -$routes->get('report/rawi_cum_month', 'Report::rawi_cum_month'); -$routes->get('report/rawi_cum_year', 'Report::rawi_cum_year'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'report/rawi_cum_day', 'Report::rawi_cum_day'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'report/rawi_cum_month', 'Report::rawi_cum_month'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'report/rawi_cum_year', 'Report::rawi_cum_year'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_consolidate_category', 'Report::rawi_consolidate'); -$routes->get('report/rawi_consolidate_month', 'Report::rawi_consolidate_month'); -$routes->get('report/rawi_consolidate_year', 'Report::rawi_consolidate_year'); -$routes->match(['GET', 'POST'], 'Report_pending_purchase', 'Report::pending_purchase'); -$routes->match(['GET', 'POST'], '/Report_pending_purchase', 'Report::pending_purchase'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'report/rawi_consolidate_month', 'Report::rawi_consolidate_month'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'report/rawi_consolidate_year', 'Report::rawi_consolidate_year'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_pending_purchase', 'Report::pending_purchase'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], '/Report_pending_purchase', 'Report::pending_purchase'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_purchase_attach', 'Report::iattach'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_monthly_gst', 'Report::monthly_gst'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_Material_inward_Register', 'User::getMaterialInwardRegister'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'DeliveryPerformance', 'User::deliver_perform'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Empperform', 'Report::per'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'hsnSalesRegister', 'Report::hsnSalesRegister'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'hsnCreditNoteRegister', 'Report::hsnCreditNoteRegister'); +$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'hsnSummaryRegister', 'Report::hsnSummaryRegister'); //stock reports $routes->match(['GET', 'POST'],'smrySilicaSandReport','Report::smrySilicaSandReport'); diff --git a/app/Controllers/Report.php b/app/Controllers/Report.php index 6632f41b..b287189c 100755 --- a/app/Controllers/Report.php +++ b/app/Controllers/Report.php @@ -1761,6 +1761,67 @@ class Report extends BaseController } + public function hsnSalesRegister(){ + + $this->global['pageTitle'] = 'Summary- HSN Sales Register Report'; + $data = []; + + if ($this->request->getPost('month')) { + $month = $this->request->getPost('month') ; + $year = $this->request->getPost('financialyear'); + $data['hsnSalesRegister'] = $this->dahsboard_Model->hsnSalesRegister($month,$year); + $data['givenMonth'] = $month ; + $data['givenYear'] = $year ; + + } + + $data['finyear'] = $this->dahsboard_Model->stockFinancialYear(); + + $this->loadviews("Report_HSNSalesRegister", $this->global, $data, NULL); + + } + + public function hsnCreditNoteRegister(){ + + + $this->global['pageTitle'] = 'Summary- HSN Credit Note Register Report'; + $data = []; + + if ($this->request->getPost('month')) { + $month = $this->request->getPost('month') ; + $year = $this->request->getPost('financialyear'); + $data['hsnCreditNoteRegister'] = $this->dahsboard_Model->hsnCreditNoteRegister($month,$year); + $data['givenMonth'] = $month ; + $data['givenYear'] = $year ; + + } + + $data['finyear'] = $this->dahsboard_Model->stockFinancialYear(); + + $this->loadviews("Report_HSNCreditNoteRegister", $this->global, $data, NULL); + + } + + public function hsnSummaryRegister(){ + + + $this->global['pageTitle'] = 'Summary- HSN Summary Register Report'; + $data = []; + + if ($this->request->getPost('month')) { + $month = $this->request->getPost('month') ; + $year = $this->request->getPost('financialyear'); + $data['hsnSummaryRegister'] = $this->dahsboard_Model->hsnSummaryRegister($month,$year); + $data['givenMonth'] = $month ; + $data['givenYear'] = $year ; + + } + + $data['finyear'] = $this->dahsboard_Model->stockFinancialYear(); + + $this->loadviews("Report_HSNSummaryRegister", $this->global, $data, NULL); + + } diff --git a/app/Models/Dashboard_model.php b/app/Models/Dashboard_model.php index 0e9fb889..fa57f080 100755 --- a/app/Models/Dashboard_model.php +++ b/app/Models/Dashboard_model.php @@ -3236,6 +3236,182 @@ function daybeforetotal($yesterday){ } + function hsnSalesRegister($month,$year){ + + $monthNum = date('m', strtotime($month)); + $startDate = $year . "-" . $monthNum . "-01"; + $endDate = $year . "-" . $monthNum . "-" . date('t', strtotime($startDate)); + + $sql = "SELECT + in_itms.hsn_or_sac as hsnOrSac, + SUM(in_itms.item_quantity) as quantity, + SUM(in_itms_amts.item_subtotal) as totalTaxableAmount, + SUM(in_itms_amts.item_cgst_amt) as cgst, + SUM(in_itms_amts.item_sgst_amt) as sgst, + SUM(in_itms_amts.item_igst_amt) as igst, + SUM(in_itms_amts.item_total) as netInvoiceAmount, + in_tr.tax_rate_percent as rateOfTax + + FROM ip_invoice_items in_itms + + join ip_invoice_item_amounts in_itms_amts + ON in_itms_amts.item_id = in_itms.item_id + + join ip_tax_rates in_tr + ON ( in_tr.tax_rate_id = in_itms.Sgst_item_tax_rate_id OR in_tr.tax_rate_id = in_itms.Igst_item_tax_rate_id) + + WHERE in_itms.item_date_added >= '$startDate' + AND in_itms.item_date_added <= '$endDate' + AND in_itms.hsn_or_sac <> 0 + + group by in_itms.hsn_or_sac + order by in_itms.hsn_or_sac asc ; + "; + + $query = $this->db->query($sql); + + $result = $query->getResultArray(); + + log_message('debug', 'HSN Sales Register Query: ' . $this->db->getLastQuery()); + + + return $result; + + } + + function hsnCreditNoteRegister($month,$year){ + + $monthNum = date('m', strtotime($month)); + $startDate = $year . "-" . $monthNum . "-01"; + $endDate = $year . "-" . $monthNum . "-" . date('t', strtotime($startDate)); + + $sql = "SELECT + salesRegister.hsnOrSac AS hsnOrSac, + SUM(in_cn.item_quantity) AS quantity, + SUM(in_cn.item_total_price) AS totalTaxableAmount, + SUM((in_cn.item_total_price * in_cn_itms.tax_percentage / 100) / 2) AS cgst, + SUM((in_cn.item_total_price * in_cn_itms.tax_percentage / 100) / 2) AS sgst, + 0 AS igst, + SUM(in_cn.item_total) AS netInvoiceAmount, + (in_cn_itms.tax_percentage /2) AS rateOfTax + + FROM ip_credit_notes_items in_cn_itms + JOIN ip_credit_notes in_cn + ON in_cn.creditnote_id = in_cn_itms.creditnote_id + RIGHT JOIN ( + SELECT + Distinct in_itms.hsn_or_sac as hsnOrSac + FROM ip_invoice_items in_itms + WHERE in_itms.item_date_added >= '$startDate' AND in_itms.item_date_added <= '$endDate' + AND in_itms.hsn_or_sac <> 0 + order by in_itms.hsn_or_sac asc + ) AS salesRegister + ON( salesRegister.hsnOrSac = in_cn_itms.hsn_or_sac + AND DATE(in_cn_itms.created_at) >= '$startDate' AND DATE(in_cn_itms.created_at) <= '$endDate') + GROUP BY salesRegister.hsnOrSac, in_cn_itms.tax_percentage + order by salesRegister.hsnOrSac asc + + "; + + $query = $this->db->query($sql); + + $result = $query->getResultArray(); + + log_message('debug', 'hsnCreditNoteRegister: '. $this->db->getLastQuery()); + + + return $result; + + } + + function hsnSummaryRegister($month,$year){ + + $monthNum = date('m', strtotime($month)); + $startDate = $year . "-" . $monthNum . "-01"; + $endDate = $year . "-" . $monthNum . "-" . date('t', strtotime($startDate)); + + $sql = "SELECT + salesRegister.hsnOrSac AS hsnOrSac, + (salesRegister.quantity - IFNULL(creditNoteRegister.quantity, 0)) AS quantity, + (salesRegister.totalTaxableAmount - IFNULL(creditNoteRegister.totalTaxableAmount, 0)) AS totalTaxableAmount, + (salesRegister.cgst - IFNULL(creditNoteRegister.cgst, 0)) AS cgst, + (salesRegister.sgst - IFNULL(creditNoteRegister.sgst, 0)) AS sgst, + (salesRegister.igst - IFNULL(creditNoteRegister.igst, 0)) AS igst, + (salesRegister.netInvoiceAmount - IFNULL(creditNoteRegister.netInvoiceAmount, 0)) AS netInvoiceAmount, + salesRegister.rateOfTax AS rateOfTax + + FROM + + ( + SELECT + in_itms.hsn_or_sac as hsnOrSac, + SUM(in_itms.item_quantity) as quantity, + SUM(in_itms_amts.item_subtotal) as totalTaxableAmount, + SUM(in_itms_amts.item_cgst_amt) as cgst, + SUM(in_itms_amts.item_sgst_amt) as sgst, + SUM(in_itms_amts.item_igst_amt) as igst, + SUM(in_itms_amts.item_total) as netInvoiceAmount, + in_tr.tax_rate_percent as rateOfTax + + FROM ip_invoice_items in_itms + + join ip_invoice_item_amounts in_itms_amts ON in_itms_amts.item_id = in_itms.item_id + + join ip_tax_rates in_tr ON ( in_tr.tax_rate_id = in_itms.Sgst_item_tax_rate_id OR in_tr.tax_rate_id = in_itms.Igst_item_tax_rate_id) + + WHERE in_itms.item_date_added >= '$startDate' AND in_itms.item_date_added <= '$endDate' + AND in_itms.hsn_or_sac <> 0 + group by in_itms.hsn_or_sac + order by in_itms.hsn_or_sac asc + ) + AS salesRegister + + LEFT JOIN ( + SELECT + salesRegister.hsnOrSac AS hsnOrSac, + SUM(in_cn.item_quantity) AS quantity, + SUM(in_cn.item_total_price) AS totalTaxableAmount, + SUM((in_cn.item_total_price * in_cn_itms.tax_percentage / 100) / 2) AS cgst, + SUM((in_cn.item_total_price * in_cn_itms.tax_percentage / 100) / 2) AS sgst, + 0 AS igst, + SUM(in_cn.item_total) AS netInvoiceAmount, + (in_cn_itms.tax_percentage /2) AS rateOfTax + + FROM ip_credit_notes_items in_cn_itms + JOIN ip_credit_notes in_cn + ON in_cn.creditnote_id = in_cn_itms.creditnote_id + RIGHT JOIN ( + SELECT + Distinct in_itms.hsn_or_sac as hsnOrSac + FROM ip_invoice_items in_itms + WHERE in_itms.item_date_added >= '$startDate' AND in_itms.item_date_added <= '$endDate' + AND in_itms.hsn_or_sac <> 0 + order by in_itms.hsn_or_sac asc + ) AS salesRegister + ON salesRegister.hsnOrSac = in_cn_itms.hsn_or_sac + AND DATE(in_cn_itms.created_at) >= '$startDate' AND DATE(in_cn_itms.created_at) <= '$endDate' + GROUP BY salesRegister.hsnOrSac, in_cn_itms.tax_percentage + order by salesRegister.hsnOrSac asc + ) + AS creditNoteRegister + + ON salesRegister.hsnOrSac = creditNoteRegister.hsnOrSac + + order by salesRegister.hsnOrSac asc + + "; + + $query = $this->db->query($sql); + + $result = $query->getResultArray(); + + log_message('debug', 'hsnSummaryRegister: '. $this->db->getLastQuery()); + + + return $result; + + } + diff --git a/app/Views/Report_HSNCreditNoteRegister.php b/app/Views/Report_HSNCreditNoteRegister.php new file mode 100644 index 00000000..0253b54d --- /dev/null +++ b/app/Views/Report_HSNCreditNoteRegister.php @@ -0,0 +1,234 @@ + + + + + +
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +

+ + +
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + $hcn) { ?> + + + + + + + + + + + + + + + + + + + + + + + +
HSN NOQuantityTotal Taxable AmountCGSTSGSTIGSTNet Invoice AmountRate Of Tax
+
+
+
+
+
+
+
+
+ + + + + + + + + + \ No newline at end of file diff --git a/app/Views/Report_HSNSalesRegister.php b/app/Views/Report_HSNSalesRegister.php new file mode 100644 index 00000000..530bd3db --- /dev/null +++ b/app/Views/Report_HSNSalesRegister.php @@ -0,0 +1,231 @@ + + + + + +
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +

+ + +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + $hs) { ?> + + + + + + + + + + + + + + + + + + + + + + + +
HSN NOQuantityTotal Taxable AmountCGSTSGSTIGSTNet Invoice AmountRate Of Tax
+
+
+
+
+
+
+
+
+ + + + + + + + + + \ No newline at end of file diff --git a/app/Views/Report_HSNSummaryRegister.php b/app/Views/Report_HSNSummaryRegister.php new file mode 100644 index 00000000..78feb46a --- /dev/null +++ b/app/Views/Report_HSNSummaryRegister.php @@ -0,0 +1,234 @@ + + + + + +
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +

+ + +
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + $hsm) { ?> + + + + + + + + + + + + + + + + + + + + + + + +
HSN NOQuantityTotal Taxable AmountCGSTSGSTIGSTNet Invoice AmountRate Of Tax
+
+
+
+
+
+
+
+
+ + + + + + + + + + \ No newline at end of file diff --git a/app/Views/reportslink.php b/app/Views/reportslink.php index 6b77f130..5841a5cd 100644 --- a/app/Views/reportslink.php +++ b/app/Views/reportslink.php @@ -16,98 +16,102 @@
- -
-
- diff --git a/app/Views/sales_dashboard.php b/app/Views/sales_dashboard.php index 94e68a82..d1cbb260 100755 --- a/app/Views/sales_dashboard.php +++ b/app/Views/sales_dashboard.php @@ -117,12 +117,12 @@

Stock Dashboard

-
- Gas   - Diesel   - Power   - Resin   - Bag   +
+ Gas + Diesel + Power + Resin + Bag