Getting a Garbage value on Printing a Page in PHP Desktop - javascript

I am Printing a invoice I filled with input values for print, After generating Final Invoice I am getting Garbage value not in correct format I have shared Below Image. But if I use Php Desktop on external Browser then Printing a page getting correct value. Thanks in Advance.
This is My json for php Desktop
{
"application": {
"single_instance_guid": "",
"dpi_aware": true
},
"debugging": {
"show_console": false,
"subprocess_show_console": false,
"log_level": "DEBUG4",
"log_file": "debug.log"
},
"main_window": {
"title": "PHP Desktop",
"icon": "",
"default_size": [1024, 768],
"minimum_size": [800, 600],
"maximum_size": [0, 0],
"disable_maximize_button": false,
"center_on_screen": true,
"start_maximized": false,
"start_fullscreen": false,
"print": true
},
"popup_window": {
"icon": "",
"fixed_title": "",
"center_relative_to_parent": true,
"default_size": [1024, 768]
},
"web_server": {
"listen_on": ["127.0.0.1", 0],
"www_directory": "www",
"index_files": ["index.html", "index.php"],
"cgi_interpreter": "php/php-cgi.exe",
"cgi_extensions": ["php"],
"cgi_temp_dir": "",
"404_handler": "/pretty-urls.php"
},
"chrome": {
"log_file": "debug.log",
"log_severity": "default",
"cache_path": "webcache",
"external_drag": true,
"external_navigation": true,
"reload_page_F5": true,
"devtools_F12": true,
"remote_debugging_port": 0,
"command_line_switches": {},
"enable_downloads": true,
"context_menu": {
"enable_menu": true,
"navigation": true,
"print": true,
"view_source": true,
"open_in_external_browser": true,
"devtools": true
}
}
}
The Above json is for PHP Desktop Settings, should I change anything in this json?
Below is my code.
function data() {
var separateDecimal = lclTotal.toString().split('.');
var paisa = parseInt(separateDecimal[1]);
var paisaInt = parseInt(paisa);
$("#txtPrintName").val($("#name").val());
$("#txtPrintAddress").val($("#address").val());
$("#txtPrintMobile").val($("#mobile").val());
}
$(document).on("click", "#print", function (e) {
// $("#supplier-info, #invoice-no, #txtUniqueNo, #delivery-note, #supplier-reference, #txtSupplierRef, #buyer, #buyer-label, #buyer-label, #txtCusName, #txtAddress, #txtGSTIN").printThis({
$("#printCode").printThis({
debug: true, // show the iframe for debugging
importCSS: true, // import page CSS
importStyle: true, // import style tags
printContainer: true, // grab outer container as well as the contents of the selector
loadCSS:"sale.css", // path to additional css file - use an array [] for multiple
pageTitle: "TAX INVOICE", // add title to print page
removeInline: true, // remove all inline styles from print elements
printDelay: 300, // variable print delay; depending on complexity a higher value may be necessary
base: true,
footer: "", // prefix to html
formValues: true // preserve input/form values
});
});

I got Fixed with, I changed version of the PHP Desktop.

Related

PHP loading JS video player

So I have this PHP script to show my videos in Fluid Player, it looks like this:
while($video = mysqli_fetch_array($resultat_video, MYSQLI_ASSOC))
{
echo "<video id='video-id'><source src='mov/$video[filnavn]' type='video/mp4' />";
}
Loading the Javascript to load Fluid players looks like this:
<script>
var myFP = fluidPlayer(
'video-id', {
"layoutControls": {
"controlBar": {
"autoHideTimeout": 3,
"animated": true,
"autoHide": true
},
"htmlOnPauseBlock": {
"html": null,
"height": null,
"width": null
},
"autoPlay": false,
"mute": true,
"allowTheatre": true,
"playPauseAnimation": false,
"playbackRateEnabled": false,
"allowDownload": false,
"playButtonShowing": false,
"fillToContainer": false,
"posterImage": ""
},
"vastOptions": {
"adList": [],
"adCTAText": false,
"adCTATextPosition": ""
}
});
</script>
This works perfectly for one video, but i guess I can't call the same ID in my PHP ID and expet it to work, so I guess it needs some sort of invidual ID both in the PHP and also in the Javascript?
I'm very new to Javascript so all help is apprichiated alot :)
Regards,
Jan

Only have remove buttons for some rows?

I have a handsontable with data that would have a property that indicates a specific status (hasShipped if specifics are required). Is there a way to remove the "remove row" button from a row where the hasShipped value is true?
Table definition, in case it's important:
var hot = new Handsontable(container, {
data: hotData,
dataSchema: { Product: null, UOM: "EA", QtyShipped: 0 },
columns: [
{
data: 'Product',
title: "Product",
type: "text",
readOnly: isShipped
},
{
data: 'UOM',
title: "UOM",
readOnly: true,
type: "text"
},
{
data: 'QtyShipped',
title: "Qty<br />Shipped",
type: "numeric",
readOnly: isShipped
}],
allowInsertRow: true,
//allowRemoveRow: true, //TODO: Depending on mode and row
autoWrapCol: true,
colHeaders: true,
columnSorting: { column: 0, sortOrder: false },
contextMenu: ['undo', 'redo', 'row_above', 'row_below', 'remove_row'],
currentColClassName: 'activeCol',
currentRowClassName: 'activeRow',
dropdownMenu: true,
fixedColumnsLeft: 1,
outsideClickDeselects: false,
readOnly: <%= IsWatchList.ToString().ToLower() %>,
removeRowPlugin: true,
rowHeaders: true,
stretchH: "all", //used in conjunction #hot-container styling to make the table take up 100% of parent width
});
Given that I was already implementing the code to remove a row and had altered the code to insert my own custom styled button, I knew where the buttons were being injected.
Thanks to MonkeyZues's comment, I looked at the code where I was injecting the remove row button and, depending on the value of the HasShipped property, was able to inject (or not) the required row buttons
if (jsonObject != "") {
if (jsonObject.LoadDetails[row]["HasShipped"] == true) {
div.appendChild(btnNode);
elem.appendChild(div);
}
}

changing tab space in atom-typescript

Atom-typescript changes tab space from 2 to 4 when we format the code.
I changed formatting.js file and set it to 2 but still i'm facing the same issue..
How can i change the tab space in atom-typescript?
below is the content of formatting.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Maintainance:
* When a new option is added add it to:
* - the FormatCodeOptions interface
* - the defaultFormatCodeOptions function
* - the makeFormatCodeOptions function
*/
const os_1 = require("os");
function defaultFormatCodeOptions() {
return {
baseIndentSize: 2,
indentSize: 2,
tabSize: 2,
newLineCharacter: os_1.EOL,
convertTabsToSpaces: true,
indentStyle: "Smart",
insertSpaceAfterCommaDelimiter: true,
insertSpaceAfterSemicolonInForStatements: true,
insertSpaceBeforeAndAfterBinaryOperators: true,
insertSpaceAfterKeywordsInControlFlowStatements: true,
insertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false,
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false,
placeOpenBraceOnNewLineForFunctions: false,
placeOpenBraceOnNewLineForControlBlocks: false,
};
}
exports.defaultFormatCodeOptions = defaultFormatCodeOptions;
//# sourceMappingURL=formatting.js.map
As suggested by #baruch, here is the reference: github.com/TypeStrong/atom-typescript/issues/1236
I'm posting what worked for me.
To change indentation to 2 for atom-typescript:
Go to your project directory.
Open or create tsconfig.json.
Add the following code
"formatCodeOptions": {
"baseIndentSize": 0,
"indentSize": 2,
"tabSize": 2,
"newLineCharacter": "\n",
"convertTabsToSpaces": true,
"indentStyle": "Smart",
"insertSpaceAfterCommaDelimiter": true,
"insertSpaceAfterSemicolonInForStatements": false,
"insertSpaceBeforeAndAfterBinaryOperators": true,
"insertSpaceAfterConstructor": false,
"insertSpaceAfterKeywordsInControlFlowStatements": true,
"insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
"insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false,
"insertSpaceBeforeFunctionParenthesis": false,
"placeOpenBraceOnNewLineForFunctions": false,
"placeOpenBraceOnNewLineForControlBlocks": false
}
This worked for me!

How to catch uncaught type errors

I have the following start to my jQuery:
(function($) {
$.widget('ui.hbTags', {
options: {
availableTags: [],
node: false,
tagList: false,
existingTags: false,
placeholder: false,
ajaxUrl: false,
existingUrl: false,
csrftoken: false
},
However, I get uncaught typeerror undefined is not a function at line 2. I know this is because ui.hbTags is not an element on every page, but how to I prevent this problem?
I would just check that the tag is on the page before I call the widget.
(function($) {
if($('ui.hbTags').length > 0) {
$.widget('ui.hbTags', {
options: {
availableTags: [],
node: false,
tagList: false,
existingTags: false,
placeholder: false,
ajaxUrl: false,
existingUrl: false,
csrftoken: false
},
If (typeof $(el) not equal 'undefined')
Use this psedo code before your code

How to use a link in TableTools instead of flash buttons

I'm trying to find a way to change the buttons on TableTools. I'd like to use my own customized links instead of the flash buttons. Is there a way I can do that? Any good resource teaching me how to make that modification and still able to use the functionalities, like button collection, etc.
According to the creator, the only way to get the TableTools export functionality is by using the Flash buttons.
The other threads that you found should say that currently, no, this
is not an option that TableTools provides. The Flash option is used to
provide cross browser / platform ability to save files entirely on the
client-side - that option simply isn't available in older browsers
(IE6, IE7 etc) where there is no support for the data:// protocol and
local file system interaction options.
It would most certainly be possible to add this ability to TableTools,
but I'm afraid I haven't yet had an opportunity to do so. It is on the
road map though.
Allan
If you are interested in creating the export files server side, you may want to consider the download (GET) plug-in for TableTools.
Yes, it is possible to override the existing buttons eg PDF/CSV etc or to create new custom buttons that have links to a url to get or post data. Here, I'm showing 2 methods with get methods:
For More info on Get & Post methods:
Visit: Datatable tabletools GET/POST download method overrides
Code generated pdf is used because pdf output from tabletools on a table that have rows grouped by some column data is overlapped.
1st to override PDF function and
2nd to create custom button.
1. Override PDF function to fetch pdf from server code.
/*Get Method table Tools - PDF - Overriding*/
TableTools.BUTTONS.pdf = {
"sAction": "text",
"sTag": "default",
"sFieldBoundary": "",
"sFieldSeperator": "\t",
"sNewLine": "<br>",
"sToolTip": "",
"sButtonClass": "DTTT_button_text",
"sButtonClassHover": "DTTT_button_text_hover",
//"sButtonText": "PDF",
"mColumns": "all",
"bHeader": true,
"bFooter": true,
"sDiv": "",
"fnMouseover": null,
"fnMouseout": null,
"fnClick": function (nButton, oConfig) {
var oParams = this.s.dt.oApi._fnAjaxParameters(this.s.dt);
var iframe = document.createElement('iframe');
iframe.style.height = "0px";
iframe.style.width = "0px";
//iframe.src = oConfig.sUrl + "?" + $.param(oParams);
iframe.src = oConfig.sUrl;//This is the URl you give in datatable Tabletools pdf override below
document.body.appendChild(iframe);
},
"fnSelect": null,
"fnComplete": null,
"fnInit": null
};
/**/
/*Datatable initialisation*/
$(document).ready(function () {
oTable = $('#alternatecolor').dataTable({
"bJQueryUI": true,
"aLengthMenu": [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"]
],
"sPaginationType": "full_numbers",
"aoColumns": [
null,
null,
null,
null,
null],
"bLengthChange": false, "bPaginate": false,
"sDom": '<"H"Tfr>t<"F"ip>',
//"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"aButtons": [
"csv", "xls",
{
/*PDF Override*/
"sExtends": "pdf",
"sButtonText": "PDF",
//Custom url to fetch pdf report
"sUrl": " report/PDFReportUsers/us/1"
}
]
}
})
/*Row grouping - optional*/
.rowGrouping({ bExpandableGrouping: true,
bExpandSingleGroup: false,
iExpandGroupOffset: -1
//asExpandedGroups: [name]
});
/**/
});
});
2. Custom button to fetch pdf from server code.
/*Get Method table Tools - Download custom button*/
TableTools.BUTTONS.download= {
"sAction": "text",
"sTag": "default",
"sFieldBoundary": "",
"sFieldSeperator": "\t",
"sNewLine": "<br>",
"sToolTip": "",
"sButtonClass": "DTTT_button_text",
"sButtonClassHover": "DTTT_button_text_hover",
//"sButtonText": "PDF",
"mColumns": "all",
"bHeader": true,
"bFooter": true,
"sDiv": "",
"fnMouseover": null,
"fnMouseout": null,
"fnClick": function (nButton, oConfig) {
var oParams = this.s.dt.oApi._fnAjaxParameters(this.s.dt);
var iframe = document.createElement('iframe');
iframe.style.height = "0px";
iframe.style.width = "0px";
//iframe.src = oConfig.sUrl + "?" + $.param(oParams);
iframe.src = oConfig.sUrl;
document.body.appendChild(iframe);
},
"fnSelect": null,
"fnComplete": null,
"fnInit": null
};
/**/
$(document).ready(function () {
oTable = $('#alternatecolor').dataTable({
"bJQueryUI": true,
"aLengthMenu": [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"]
],
"sPaginationType": "full_numbers",
"aoColumns": [
null,
null,
null,
null,
null],
"bLengthChange": false, "bPaginate": false,
"sDom": '<"H"Tfr>t<"F"ip>',
//"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"aButtons": [
"csv", "xls"
, {
"sExtends": "download",
"sButtonText": "Download PDF",
"sUrl": "admin/user/4/downloadfile"
}
]
}
})
/*Row grouping - optional */
.rowGrouping({ bExpandableGrouping: true,
bExpandSingleGroup: false,
iExpandGroupOffset: -1
//asExpandedGroups: [name]
});
/**/
});

Categories

Resources