Hello Team,
Please am using angular controllerJS in my MVC application and bootstrap template to print transactions after sales,
but in the process of printing, the template sidebar and the invoice print together and want i want to do is to hide the sidebar
function GetAllPrintSalesRecord() {
debugger;
const urlParams = new URLSearchParams(window.location.search);
const OrderNo = urlParams.get('OrderNo');
.then(function (response) {
var data = response.data.modifiedData;
$scope.PrintSalesRecordList = data;
$scope.Total = response.data.total;
$scope.DiscountTotal = response.data.discount;
$scope.VatTotal = response.data.tax;
debugger
if ($scope.$$phase) {
$scope.$apply();
}
});
}
}]);
}).call(angular);
//Print Script
$('#invoice-printed').click(function () {
$('body').css('visibility', 'hidden');
$('#accordionSidebar').css('display', 'none');
$('.panel-body').css('visibility', 'visible');
$('#exampleInputUser').css('display', 'none');
window.print();
$('#accordionSidebar').css('display', '');
$('body').css('visibility', 'visible');
});
Vishal JoshiPosted Oct 21, 2023, 5:35 AM
Hello Emmanuel,
Replace the below code with the function 'GetAllPrintSalesRecord()'.
Thanks
Vishal Joshi
Emmmanuel FIADUFEPosted Oct 21, 2023, 9:10 AM
Thank you Vishal and Mohammed for your support
Tahir AnsariPosted Oct 21, 2023, 4:51 AM
In your HTML template, you can create a separate print CSS to hide the sidebar when printing:
Modify your script to handle the printing action
the code is wrapped in a
$(document).readyfunction to ensure it runs when the document is fully loaded. It hides the sidebar, prints the page, and then restores the visibility and display settings after printing.Please make sure to include the above CSS and script in the appropriate places within your HTML file, and ensure that the
#invoice-printedelement corresponds to the button or link that triggers the printing action.