Global Sea Freight Calculator
Calculation Results
Calculation Steps
Total Weight: 100,000 kg (100 MT)
Total Bags: 2000 bags (50 kg each)
Bag Volume: 0.069 m³ per bag
Layers per Pallet: 16 layers
Total Pallets: 63 pallets
Total Bags:
2000
Total Weight:
100,000 kg
Total Volume:
138 m³
Bags per Pallet:
32
Total Pallets:
63
Containers Required (by weight):
4
Containers Required (by volume):
5
Final Containers Needed:
4
Weight-limited shipment
Container Visualization
Visualization will appear here after calculation
`);
printWindow.document.close();
// Wait for content to load before printing
printWindow.onload = function() {
printWindow.print();
// printWindow.close(); // Uncomment to close after printing
};
}// Export results to Excel
function exportToExcel() {
if (!calculationResults) {
alert('Please calculate results first');
return;
}
// Create CSV content
const csvContent = [
['Metric', 'Value'],
['Total Weight (kg)', calculationResults.totalWeightKg],
['Total Bags', calculationResults.totalBags],
['Total Volume (m³)', calculationResults.totalVolume],
['Bags per Pallet', calculationResults.bagsPerPallet],
['Total Pallets', calculationResults.totalPallets],
['Containers Required (by weight)', calculationResults.containersByWeight],
['Containers Required (by volume)', calculationResults.containersByVolume],
['Final Containers Needed', calculationResults.finalContainers],
['Container Type', calculationResults.containerType],
['Commodity Type', calculationResults.commodityType],
['Commodity Density (kg/m³)', calculationResults.commodityDensity],
['Origin Country', calculationResults.originCountry],
['Origin Port', calculationResults.originPort],
['Destination Country', calculationResults.destinationCountry],
['Destination Port', calculationResults.destinationPort]
].map(row => row.join(',')).join('\n');
// Create download link
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
const link = document.createElement('a');
const url = URL.createObjectURL(blob);
link.setAttribute('href', url);
link.setAttribute('download', 'sea_freight_calculations.csv');
link.style.visibility = 'hidden';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}// Export results to CSV
function exportToCsv() {
// For this implementation, CSV and Excel export are the same
exportToExcel();
}
// Print calculator
function printCalculator() {
window.print();
}
// Print results
function printResults() {
switchToTab('results');
setTimeout(() => {
window.print();
}, 100);
}
// Print visualization
function printVisualization() {
switchToTab('visualization');
setTimeout(() => {
window.print();
}, 100);
}// Public API
return {
init,
calculate: calculateResults,
reset: resetForm,
exportToCsv,
exportToExcel,
exportToPdf
};
})();// Initialize the application when DOM is loaded
document.addEventListener('DOMContentLoaded', window.FCAC.init);