appendImportedData_Impact = async book => {
console.log("appendImportedData_Impact function called")
try {
const _selectedAnsweredEntry = this.state.selectedworkshop.answeredEntries;
if (!_selectedAnsweredEntry) {
this.state.selectedworkshop.answeredEntries = [];
this.setState({
selectedworkshop: { ...this.state.selectedworkshop, answeredEntries: [] },
});
}
const selectedAnsweredEntry = this.state.selectedworkshop.answeredEntries;
let _worksheet = this.state.selectedworkshop.worksheet
.filter((item, index, self) => index === self.findIndex(t => t.id === item.id))
.sort((a, b) => {
if (a.framework == 'CSRD') {
let _a =
CSRDAllTopics?.find(
item2 => item2['mainId'] == a['mainId'] && item2['topic'] == a['topic'],
)?.sortIndex || 0;
let _b =
CSRDAllTopics?.find(
item2 => item2['mainId'] == b['mainId'] && item2['topic'] == b['topic'],
)?.sortIndex || 0;
return _a < _b ? -1 : _a > _b ? 1 : 0;
}
if (a.framework == 'GRI') {
let _a = a.id;
let _b = b.id;
return _a < _b ? -1 : _a > _b ? 1 : 0;
}
if (a.topic < b.topic) return -1;
if (a.topic > b.topic) return 1;
})
.sort((a, b) => {
if (this.renderESG(a.dimension) == 'Environmental') return -1;
if (this.renderESG(b.dimension) == 'Environmental') return 1;
if (this.renderESG(a.dimension) == 'Social') return -1;
if (this.renderESG(b.dimension) == 'Social') return 1;
if (this.renderESG(a.dimension) == 'Governance') return -1;
if (this.renderESG(b.dimension) == 'Governance') return 1;
if (this.renderESG(a.dimension) < this.renderESG(b.dimension)) return -1;
if (this.renderESG(a.dimension) > this.renderESG(b.dimension)) return 1;
})
.sort((a, b) => {
if (this.renderESG(a.dimension) == 'Environmental') return -1;
if (this.renderESG(b.dimension) == 'Environmental') return 1;
if (this.renderESG(a.dimension) == 'Social') return -1;
if (this.renderESG(b.dimension) == 'Social') return 1;
if (this.renderESG(a.dimension) == 'Governance') return -1;
if (this.renderESG(b.dimension) == 'Governance') return 1;
if (this.renderESG(a.dimension) < this.renderESG(b.dimension)) return -1;
if (this.renderESG(a.dimension) > this.renderESG(b.dimension)) return 1;
})
.filter((item, index) => {
return item.entryType !== 'comment' && item.entryType !== 'added-entry';
});
let allAnsweredEntries = [];
_worksheet.forEach(item => {
const answerData = this.state.answeredTopics.find(data => data.id === item.id);
let answer = '';
if (answerData) {
answer = answerData;
}
const topicResult = this.state.surveyResultsIROComments.filter(
item2 => item2.id == item.id,
);
let allComments = this.getAllCommentsFromShortSurvey_Impact(
topicResult,
Array.from(this.state.financialConsolidatedReports || []),
Array.from(this.state.addedCommentTopics || []),
);
if (allComments.length > 0) {
allComments
.filter((v, i, a) => a.findIndex(t => t.id === v.id) === i)
.filter(item => (item.assessmentType ? item.assessmentType == 'Impact' : item))
.forEach((commData, commIndex) => {
let item = commData;
const workshopWithEntry = Array.from(this.state.workshops || [])
.concat(Array.from(this.state.financialworkshops || []))
.find(ws => {
return Array.from(ws.worksheet || []).find(data => data.id === commData.id);
});
if (workshopWithEntry) {
const prevItem = Array.from(workshopWithEntry.worksheet || []).find(
data => data.id === commData.id,
);
if (prevItem) {
item = prevItem;
}
}
const answerData = this.state.answeredTopics.find(data => data.id === item.id);
let answer = '';
if (answerData) {
answer = answerData;
}
const entryId = `${this.state.surveyId}__${this.state.selectedworkshop.id}__${item.id}`;
let entry = {
topic: item.topic,
id: entryId,
surveyId: this.state.surveyId,
workshopId: this.state.selectedworkshop.id,
oldid: item.id,
};
if (
item?.entryType == 'comment' &&
(!answer?.['Verification'] ||
answer?.['Verification']?.value == 'No' ||
answer?.['Verification']?.value == '')
) {
return null;
}
allAnsweredEntries.push(entry);
});
}
});
if (book && book.SheetNames) {
book.SheetNames.forEach((parentitem, parentindex) => {
const data = xlsx2.utils.sheet_to_json(book.Sheets[parentitem]);
data.forEach(item => {
const itemFind = selectedAnsweredEntry?.find(item2 => item2.topic == item['Topic']);
if (item?.['Comment or Added Entry'] == 'Yes') {
if (itemFind) {
if (parentindex == 0) {
itemFind[`Consolidated Level`] = item[`Consolidated Level`] || '';
if (item[`Entity-Specific`]) {
itemFind[`Entity-Specific`] =
item[`Entity-Specific`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
if (item[`Country-Specific`]) {
itemFind[`Country-Specific`] =
item[`Country-Specific`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
if (item[`Sector-Specific`]) {
itemFind[`Sector-Specific`] =
item[`Sector-Specific`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
} else if (parentindex == 1) {
if (item[`Stakeholder Type`]) {
itemFind[`Stakeholder Type`] =
item[`Stakeholder Type`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
if (item[`Location in the Value Chain`]) {
itemFind[`Location in the Value Chain`] =
item[`Location in the Value Chain`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
} else if (parentindex == 2) {
itemFind[`Type of Impact`] = item[`Type of Impact`] || '';
itemFind[`Actual or Potential`] = item[`Actual or Potential`] || '';
itemFind[`Timeframe`] = item[`Timeframe`] || '';
itemFind[`People or Environmental`] = item[`People or Environmental`] || '';
itemFind[`Likelihood`] = item[`Likelihood`] || '';
itemFind[`Remediability`] = item[`Remediability`] || '';
itemFind[`Scale`] = item[`Scale`] || '';
itemFind[`Scope`] = item[`Scope`] || '';
itemFind[`Scoring Comments`] = item[`Comments`] || '';
itemFind[`Scoring Task Description`] = item[`Task Description`] || '';
} else if (parentindex == 3) {
itemFind[`VAR - Maximum Value at Risk`] = item[`Maximum Value at Risk`] || '';
itemFind[`VAR - Revenue`] = item[`Revenue`] || '';
itemFind[`VAR - Expenditure`] = item[`Expenditure`] || '';
itemFind[`VAR - Assets`] = item[`Assets`] || '';
itemFind[`VAR - Liabilities`] = item[`Liabilities`] || '';
itemFind[`VAR - Capital`] = item[`Capital`] || '';
itemFind[`VAR - Financing`] = item[`Financing`] || '';
itemFind[`VAR Task Description`] = item[`Task Description`] || '';
}
} else {
let itemFind = {};
let answeredEntryFind = allAnsweredEntries.find(
item2 => item2['topic'] == item['Topic'],
);
if (answeredEntryFind) {
itemFind = {
...itemFind,
...answeredEntryFind,
};
}
if (parentindex == 0) {
itemFind[`Consolidated Level`] = item[`Consolidated Level`] || '';
if (item[`Entity-Specific`]) {
itemFind[`Entity-Specific`] =
item[`Entity-Specific`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
if (item[`Country-Specific`]) {
itemFind[`Country-Specific`] =
item[`Country-Specific`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
if (item[`Sector-Specific`]) {
itemFind[`Sector-Specific`] =
item[`Sector-Specific`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
} else if (parentindex == 1) {
if (item[`Stakeholder Type`]) {
itemFind[`Stakeholder Type`] =
item[`Stakeholder Type`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
if (item[`Location in the Value Chain`]) {
itemFind[`Location in the Value Chain`] =
item[`Location in the Value Chain`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
} else if (parentindex == 2) {
itemFind[`Type of Impact`] = item[`Type of Impact`] || '';
itemFind[`Actual or Potential`] = item[`Actual or Potential`] || '';
itemFind[`Timeframe`] = item[`Timeframe`] || '';
itemFind[`People or Environmental`] = item[`People or Environmental`] || '';
itemFind[`Likelihood`] = item[`Likelihood`] || '';
itemFind[`Remediability`] = item[`Remediability`] || '';
itemFind[`Scale`] = item[`Scale`] || '';
itemFind[`Scope`] = item[`Scope`] || '';
itemFind[`Scoring Comments`] = item[`Comments`] || '';
itemFind[`Scoring Task Description`] = item[`Task Description`] || '';
} else if (parentindex == 3) {
itemFind[`VAR - Maximum Value at Risk`] = item[`Maximum Value at Risk`] || '';
itemFind[`VAR - Revenue`] = item[`Revenue`] || '';
itemFind[`VAR - Expenditure`] = item[`Expenditure`] || '';
itemFind[`VAR - Assets`] = item[`Assets`] || '';
itemFind[`VAR - Liabilities`] = item[`Liabilities`] || '';
itemFind[`VAR - Capital`] = item[`Capital`] || '';
itemFind[`VAR - Financing`] = item[`Financing`] || '';
itemFind[`VAR Task Description`] = item[`Task Description`] || '';
}
selectedAnsweredEntry.push(itemFind);
}
}
});
});
}
const { surveyId, currentSurveyId, consultantId, selectedworkshop } = this.state;
// const matrixWorkshopsRef = firebase
// .firestore()
// .collection(consultantId ? 'portfolio-surveys-consultants' : 'surveys')
// .doc(surveyId ? surveyId : currentSurveyId)
// .collection('workshops')
// .doc(selectedworkshop.id);
const updatedWorkshop = {
...selectedworkshop,
answeredEntries: [...selectedworkshop.answeredEntries, ...selectedAnsweredEntry].filter(
(item, index, self) => index === self.findIndex(t => t.id === item.id),
),
};
console.log('updatedWorkshop', updatedWorkshop);
this.setState({
selectedworkshop: updatedWorkshop,
loading: false,
});
const payload = [...selectedworkshop.answeredEntries, ...selectedAnsweredEntry].filter(
(item, index, self) => index === self.findIndex(t => t.id === item.id),
)
updateWorkshopProperty({
surveyId,
consultantId,
workshopId: selectedworkshop.id,
type: "impact",
property: "answeredEntries"
}, payload).then((res) => {
console.log("submitted to api", res)
}).catch(error => {
console.log('error saving answered entries');
});
// matrixWorkshopsRef
// .update({
// answeredEntries: [...selectedworkshop.answeredEntries, ...selectedAnsweredEntry].filter(
// (item, index, self) => index === self.findIndex(t => t.id === item.id),
// ),
// })
// .then(() => {
// console.log(`saved answered entries`);
// })
// .catch(error => {
// console.log('error saving answered entries');
// });
// Reset the input
const fileinput = document.getElementById('file-input-topics');
if (fileinput) {
fileinput.value = null;
}
} catch (ex) {
console.log(ex.message);
this.setState({ loading: false });
// Reset the input
const fileinput = document.getElementById('file-input-topics');
if (fileinput) {
fileinput.value = null;
}
return;
}
};
appendImportedData_Financial = async book => {
try {
const _selectedAnsweredEntry = this.state.selectedfinancialworkshop.answeredEntries;
if (!_selectedAnsweredEntry) {
this.state.selectedfinancialworkshop.answeredEntries = [];
this.setState({
selectedfinancialworkshop: {
...this.state.selectedfinancialworkshop,
answeredEntries: [],
},
});
}
const selectedAnsweredEntry = this.state.selectedfinancialworkshop.answeredEntries;
let _worksheet = this.state.selectedfinancialworkshop.worksheet
.sort((a, b) => {
if (a.framework == 'CSRD') {
let _a =
CSRDAllTopics?.find(
item2 => item2['mainId'] == a['mainId'] && item2['topic'] == a['topic'],
)?.sortIndex || 0;
let _b =
CSRDAllTopics?.find(
item2 => item2['mainId'] == b['mainId'] && item2['topic'] == b['topic'],
)?.sortIndex || 0;
return _a < _b ? -1 : _a > _b ? 1 : 0;
}
if (a.framework == 'GRI') {
let _a = a.id;
let _b = b.id;
return _a < _b ? -1 : _a > _b ? 1 : 0;
}
if (a.topic < b.topic) return -1;
if (a.topic > b.topic) return 1;
})
.sort((a, b) => {
if (this.renderESG(a.dimension) == 'Environmental') return -1;
if (this.renderESG(b.dimension) == 'Environmental') return 1;
if (this.renderESG(a.dimension) == 'Social') return -1;
if (this.renderESG(b.dimension) == 'Social') return 1;
if (this.renderESG(a.dimension) == 'Governance') return -1;
if (this.renderESG(b.dimension) == 'Governance') return 1;
if (this.renderESG(a.dimension) < this.renderESG(b.dimension)) return -1;
if (this.renderESG(a.dimension) > this.renderESG(b.dimension)) return 1;
})
.sort((a, b) => {
if (this.renderESG(a.dimension) == 'Environmental') return -1;
if (this.renderESG(b.dimension) == 'Environmental') return 1;
if (this.renderESG(a.dimension) == 'Social') return -1;
if (this.renderESG(b.dimension) == 'Social') return 1;
if (this.renderESG(a.dimension) == 'Governance') return -1;
if (this.renderESG(b.dimension) == 'Governance') return 1;
if (this.renderESG(a.dimension) < this.renderESG(b.dimension)) return -1;
if (this.renderESG(a.dimension) > this.renderESG(b.dimension)) return 1;
})
.filter((item, index) => {
return item.entryType !== 'comment' && item.entryType !== 'added-entry';
});
let allAnsweredEntries = [];
_worksheet.forEach(item => {
let verifiedTopic = '';
if (item.value) {
if (Array.isArray(item.value)) {
verifiedTopic = item.value.map(item => item.label).join(', ');
} else {
verifiedTopic = item.value;
}
}
const answerData = this.state.answeredTopics.find(data => data.id === item.id);
let answer = '';
if (answerData) {
answer = answerData;
}
const riskValue = answer['Risk']?.value || '';
const oppValue = answer['Opportunities']?.value || '';
let riskValueColor = '#fff';
let oppValueColor = '#fff';
if (riskValue === 'Yes') {
riskValueColor = '#D1060A';
} else if (riskValue === 'No') {
riskValueColor = '#2EB917';
}
if (oppValue === 'Yes') {
oppValueColor = '#2EB917';
}
const topicResult = this.state.surveyResultsIROComments.filter(
item2 => item2.id == item.id,
);
let allComments = this.getAllCommentsFromShortSurvey_Financial(
topicResult,
Array.from(this.state.financialConsolidatedReports || []),
Array.from(this.state.addedCommentTopics || []),
);
if (allComments.length > 0) {
allComments
.filter((v, i, a) => a.findIndex(t => t.id === v.id) === i)
.filter(item => (item.assessmentType ? item.assessmentType == 'Financial' : item))
.forEach((commData, commIndex) => {
let addedEntryTopicName = '';
let item = commData;
const workshopWithEntry = Array.from(this.state.workshops || [])
.concat(Array.from(this.state.financialworkshops || []))
.find(ws => {
return Array.from(ws.worksheet || []).find(data => data.id === commData.id);
});
if (workshopWithEntry) {
const prevItem2 = Array.from(workshopWithEntry.worksheet || []).find(
data => data.id === commData.id,
);
if (prevItem2) {
addedEntryTopicName = prevItem2;
}
}
const prevItem = Array.from(
this.state.selectedfinancialworkshop.worksheet || [],
).find(data => data.id === commData.id);
if (prevItem) {
item = prevItem;
}
let verifiedTopic = '';
if (item.value) {
if (Array.isArray(item.value)) {
verifiedTopic = item.value.map(item => item.label).join(', ');
} else {
verifiedTopic = item.value;
}
}
const answerData = this.state.answeredTopics.find(data => data.id === item.id);
let answer = '';
if (answerData) {
answer = answerData;
}
const entryId = `${this.state.surveyId}__${this.state.selectedfinancialworkshop.id}__${item.id}`;
let entry = {
topic: item.topic,
id: entryId,
surveyId: this.state.surveyId,
workshopId: this.state.selectedfinancialworkshop.id,
oldid: item.id,
};
const answeredEntryData = this.state.selectedfinancialworkshop?.answeredEntries?.find(
entry => entry.id === entryId,
);
if (answeredEntryData) {
entry = {
...entry,
...answeredEntryData,
};
}
if (
item?.entryType == 'comment' &&
(!answer?.['Verification'] ||
answer?.['Verification']?.value == 'No' ||
answer?.['Verification']?.value == '')
) {
return null;
}
allAnsweredEntries.push(entry);
});
}
});
if (book && book.SheetNames) {
book.SheetNames.forEach((parentitem, parentindex) => {
const data = xlsx2.utils.sheet_to_json(book.Sheets[parentitem]);
data.forEach(item => {
const itemFind = selectedAnsweredEntry?.find(item2 => item2.topic == item['Topic']);
if (item?.['Comment or Added Entry'] == 'Yes') {
if (itemFind) {
if (parentindex == 0) {
itemFind[`Type of Impact`] = item[`Type of Impact`] || '';
itemFind[`Consolidated Level`] = item[`Consolidated Level`] || '';
if (item[`Entity-Specific`]) {
itemFind[`Entity-Specific`] =
item[`Entity-Specific`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
if (item[`Country-Specific`]) {
itemFind[`Country-Specific`] =
item[`Country-Specific`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
if (item[`Sector-Specific`]) {
itemFind[`Sector-Specific`] =
item[`Sector-Specific`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
} else if (parentindex == 1) {
if (item[`Stakeholder Type`]) {
itemFind[`Stakeholder Type`] =
item[`Stakeholder Type`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
if (item[`Location in the Value Chain`]) {
itemFind[`Location in the Value Chain`] =
item[`Location in the Value Chain`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
if (item[`Significant Assets`]) {
itemFind[`Significant Assets`] =
item[`Significant Assets`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
itemFind[`Significant Locations`] = item[`Significant Locations`] || '';
} else if (parentindex == 2) {
itemFind[`Type of Impact`] = item[`Type of Impact`] || '';
itemFind[`Actual or Potential`] = item[`Actual or Potential`] || '';
itemFind[`Timeframe`] = item[`Timeframe`] || '';
itemFind[`Likelihood`] = item[`Likelihood`] || '';
itemFind[`Magnitude`] = item[`Magnitude`] || '';
itemFind[`Scoring Comments`] = item[`Comments`] || '';
itemFind[`Scoring Task Description`] = item[`Task Description`] || '';
} else if (parentindex == 3) {
itemFind[`VAR - Maximum Value at Risk`] = item[`Maximum Value at Risk`] || '';
itemFind[`VAR - Opportunity Value`] = item[`Opportunity Value`] || '';
itemFind[`VAR - Revenue`] = item[`Revenue`] || '';
itemFind[`VAR - Expenditure`] = item[`Expenditure`] || '';
itemFind[`VAR - Assets`] = item[`Assets`] || '';
itemFind[`VAR - Liabilities`] = item[`Liabilities`] || '';
itemFind[`VAR - Capital`] = item[`Capital`] || '';
itemFind[`VAR - Financing`] = item[`Financing`] || '';
itemFind[`VAR Task Description`] = item[`Task Description`] || '';
}
} else {
let itemFind = {};
let answeredEntryFind = allAnsweredEntries.find(
item2 => item2['topic'] == item['Topic'],
);
if (answeredEntryFind) {
itemFind = {
...itemFind,
...answeredEntryFind,
};
}
if (parentindex == 0) {
itemFind[`Type of Impact`] = item[`Type of Impact`] || '';
itemFind[`Consolidated Level`] = item[`Consolidated Level`] || '';
if (item[`Entity-Specific`]) {
itemFind[`Entity-Specific`] =
item[`Entity-Specific`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
if (item[`Country-Specific`]) {
itemFind[`Country-Specific`] =
item[`Country-Specific`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
if (item[`Sector-Specific`]) {
itemFind[`Sector-Specific`] =
item[`Sector-Specific`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
} else if (parentindex == 1) {
if (item[`Stakeholder Type`]) {
itemFind[`Stakeholder Type`] =
item[`Stakeholder Type`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
if (item[`Location in the Value Chain`]) {
itemFind[`Location in the Value Chain`] =
item[`Location in the Value Chain`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
if (item[`Significant Assets`]) {
itemFind[`Significant Assets`] =
item[`Significant Assets`]
?.split(', ')
?.map(item2 => ({ value: item2, label: item2 })) || null;
}
itemFind[`Significant Locations`] = item[`Significant Locations`] || '';
} else if (parentindex == 2) {
itemFind[`Type of Impact`] = item[`Type of Impact`] || '';
itemFind[`Actual or Potential`] = item[`Actual or Potential`] || '';
itemFind[`Timeframe`] = item[`Timeframe`] || '';
itemFind[`Likelihood`] = item[`Likelihood`] || '';
itemFind[`Magnitude`] = item[`Magnitude`] || '';
itemFind[`Scoring Comments`] = item[`Comments`] || '';
itemFind[`Scoring Task Description`] = item[`Task Description`] || '';
} else if (parentindex == 3) {
itemFind[`VAR - Maximum Value at Risk`] = item[`Maximum Value at Risk`] || '';
itemFind[`VAR - Opportunity Value`] = item[`Opportunity Value`] || '';
itemFind[`VAR - Revenue`] = item[`Revenue`] || '';
itemFind[`VAR - Expenditure`] = item[`Expenditure`] || '';
itemFind[`VAR - Assets`] = item[`Assets`] || '';
itemFind[`VAR - Liabilities`] = item[`Liabilities`] || '';
itemFind[`VAR - Capital`] = item[`Capital`] || '';
itemFind[`VAR - Financing`] = item[`Financing`] || '';
itemFind[`VAR Task Description`] = item[`Task Description`] || '';
}
selectedAnsweredEntry.push(itemFind);
}
}
});
});
}
const { surveyId, currentSurveyId, consultantId, selectedfinancialworkshop } = this.state;
// const matrixWorkshopsRef = firebase
// .firestore()
// .collection(consultantId ? 'portfolio-surveys-consultants' : 'surveys')
// .doc(surveyId ? surveyId : currentSurveyId)
// .collection('financial-workshops')
// .doc(selectedfinancialworkshop.id);
const updatedWorkshop = {
...selectedfinancialworkshop,
answeredEntries: [
...selectedfinancialworkshop.answeredEntries,
...selectedAnsweredEntry,
].filter((item, index, self) => index === self.findIndex(t => t.id === item.id)),
};
this.setState({
selectedfinancialworkshop: updatedWorkshop,
loading: false,
});
const payload = [
...selectedfinancialworkshop.answeredEntries,
...selectedAnsweredEntry,
].filter((item, index, self) => index === self.findIndex(t => t.id === item.id));
updateWorkshopProperty({
surveyId,
consultantId,
workshopId: selectedfinancialworkshop.id,
type: "financial",
property: "answeredEntries"
}, payload).then((res) => {
console.log("submitted to api", res)
}).catch(error => {
console.log('error saving answered entries');
});
// matrixWorkshopsRef
// .update({
// answeredEntries: [
// ...selectedfinancialworkshop.answeredEntries,
// ...selectedAnsweredEntry,
// ].filter((item, index, self) => index === self.findIndex(t => t.id === item.id)),
// })
// .then(() => {
// console.log(`saved answered entries`);
// })
// .catch(error => {
// console.log('error saving answered entries');
// });
// Reset the input
const fileinput = document.getElementById('file-input-topics');
if (fileinput) {
fileinput.value = null;
}
} catch (ex) {
console.log(ex.message);
this.setState({ loading: false });
// Reset the input
const fileinput = document.getElementById('file-input-topics');
if (fileinput) {
fileinput.value = null;
}
return;
}
};
saveFinancialWorkshopAnswerEntry = () => {
const { surveyId, currentSurveyId, consultantId, selectedfinancialworkshop } = this.state;
// const matrixWorkshopsRef = firebase
// .firestore()
// .collection(consultantId ? 'portfolio-surveys-consultants' : 'surveys')
// .doc(surveyId ? surveyId : currentSurveyId)
// .collection('financial-workshops')
// .doc(selectedfinancialworkshop.id);
const updatedWorkshop = {
...selectedfinancialworkshop,
answeredEntries: [...selectedfinancialworkshop.answeredEntries],
};
const newWorkshops = Array.from(this.state.financialworkshops || []);
const workshopIndex = newWorkshops.findIndex(item => item.id === updatedWorkshop.id);
if (workshopIndex > -1) {
newWorkshops[workshopIndex] = updatedWorkshop;
this.setState({
financialworkshops: newWorkshops,
selectedfinancialworkshop: updatedWorkshop,
});
} else {
this.setState({
selectedfinancialworkshop: updatedWorkshop,
});
}
saveToWorkshopAnswerEntry({
surveyId,
consultantId,
workshopId: selectedfinancialworkshop.id,
type: "financial",
}, [...selectedfinancialworkshop.answeredEntries]).then((res) => {
console.log("added to workshop entry", res)
}).catch(error => {
console.log('error saving entry');
});
// matrixWorkshopsRef
// .update({
// answeredEntries: [...selectedfinancialworkshop.answeredEntries],
// })
// .then(() => {
// console.log(`saved entry`);
// })
// .catch(error => {
// console.log('error saving entry');
// });
};
handleFinancialWorkshopAnswerEntryChange = (e, item, key) => {
const { selectedfinancialworkshop } = this.state;
const itemFind = selectedfinancialworkshop?.answeredEntries?.find(
item2 => item['id'] == item2['id'],
);
if (itemFind) {
if (key) {
itemFind[key] = e;
this.setState({
selectedfinancialworkshop: {
...selectedfinancialworkshop,
answeredEntries: [...selectedfinancialworkshop.answeredEntries],
},
});
return;
}
if (e.target.name == 'Consolidated Level') {
if (e.target.value == 'Yes') {
itemFind['Entity-Specific'] = null;
itemFind['Country-Specific'] = null;
itemFind['Sector-Specific'] = null;
}
}
itemFind[e.target.name] = e.target.value;
this.setState({
selectedfinancialworkshop: {
...selectedfinancialworkshop,
answeredEntries: [...selectedfinancialworkshop.answeredEntries],
},
});
} else {
const itemFind = {
...item,
};
let newAnsweredEntries = [];
if (selectedfinancialworkshop.answeredEntries) {
newAnsweredEntries = [...selectedfinancialworkshop.answeredEntries];
}
if (key) {
itemFind[key] = e;
newAnsweredEntries.push(itemFind);
selectedfinancialworkshop.answeredEntries = newAnsweredEntries;
this.setState({
selectedfinancialworkshop: {
...selectedfinancialworkshop,
answeredEntries: [...newAnsweredEntries],
},
});
return;
}
if (e.target.name == 'Consolidated Level') {
if (e.target.value == 'Yes') {
itemFind['Entity-Specific'] = null;
itemFind['Country-Specific'] = null;
itemFind['Sector-Specific'] = null;
}
}
itemFind[e.target.name] = e.target.value;
newAnsweredEntries.push(itemFind);
selectedfinancialworkshop.answeredEntries = newAnsweredEntries;
this.setState({
selectedfinancialworkshop: {
...selectedfinancialworkshop,
answeredEntries: [...newAnsweredEntries],
},
});
}
};
saveWorkshopAnswerEntry = () => {
const { surveyId, currentSurveyId, consultantId, selectedworkshop } = this.state;
console.log("selectedworkshop in saveWorkshopAnswerEntry", selectedworkshop)
// const matrixWorkshopsRef = firebase
// .firestore()
// .collection(consultantId ? 'portfolio-surveys-consultants' : 'surveys')
// .doc(surveyId ? surveyId : currentSurveyId)
// .collection('workshops')
// .doc(selectedworkshop.id);
const updatedWorkshop = {
...selectedworkshop,
answeredEntries: [...selectedworkshop.answeredEntries],
};
const newWorkshops = Array.from(this.state.workshops || []);
const workshopIndex = newWorkshops.findIndex(item => item.id === updatedWorkshop.id);
if (workshopIndex > -1) {
newWorkshops[workshopIndex] = updatedWorkshop;
this.setState({
workshops: newWorkshops,
selectedworkshop: updatedWorkshop,
});
} else {
this.setState({
selectedworkshop: updatedWorkshop,
});
}
saveToWorkshopAnswerEntry({
surveyId,
consultantId,
workshopId: selectedworkshop.id,
type: "impact",
}, [...selectedworkshop.answeredEntries]).then((res) => {
console.log("added to workshop entry", res)
}).catch(error => {
console.log('error saving entry');
});
// Create POST api to answeredEntries in Porfolio-survey-consultatnts/survey Models or WorkshopsModel?
// matrixWorkshopsRef
// .update({
// answeredEntries: [...selectedworkshop.answeredEntries],
// })
// .then(() => {
// console.log(`saved entry`);
// })
// .catch(error => {
// console.log('error saving entry');
// });
};
handleWorkshopWorksheetChange = (e, item, key) => {
console.log("handleWorkshopWorksheetChange", item, e, key);
const { selectedworkshop, surveyId, consultantId, answeredTopics } = this.state;
console.log("selectedworkshop", selectedworkshop);
const itemFind = selectedworkshop.worksheet.find(item2 =>
item['id'] ? item['id'] == item2['id'] : item['code'] == item2['code'],
);
// console.log('e', e);
// console.log('item', item);
// console.log('key', key);
console.log('itemFind', itemFind);
if (itemFind) {
console.log("edit condition entered");
if (key) {
itemFind[key] = e;
this.setState({
selectedworkshop: { ...selectedworkshop, worksheet: [...selectedworkshop.worksheet] },
});
// console.log('item', item);
// console.log('itemFind', itemFind);
// console.log('selectedworkshop.worksheet', selectedworkshop.worksheet);
return;
}
if (e.target.name == 'Consolidated Level') {
if (e.target.value == 'Yes') {
itemFind['Entity-Specific'] = null;
itemFind['Country-Specific'] = null;
itemFind['Sector-Specific'] = null;
}
}
itemFind[e.target.name] = e.target.value;
this.setState({
selectedworkshop: { ...selectedworkshop, worksheet: [...selectedworkshop.worksheet] },
});
const newAnswered = Array.from(this.state.answeredTopics || []);
const answerData = newAnswered.find(ans => ans.id === item.id);
console.log("answerData in edit condition", answerData)
if (answerData) {
answerData[e.target.name] = e.target.value;
console.log('3');
this.setState({
answeredTopics: newAnswered,
});
const workshopId = selectedworkshop.id;
editAnsweredTopicComment(
{
surveyId,
consultantId,
workshopId,
},
itemFind,
)
.then(response => {
console.log('Added new comment', response);
})
.catch(error => {
console.log('error adding new row');
});
// const matrixWorkshopsRef = firebase
// .firestore()
// .collection(this.state.consultantId ? 'portfolio-surveys-consultants' : 'surveys')
// .doc(this.state.surveyId ? this.state.surveyId : this.state.currentSurveyId);
// matrixWorkshopsRef
// .update({
// answeredTopics: newAnswered,
// })
// .then(() => {
// console.log(`Added new row`);
// })
// .catch(error => {
// console.log('error adding new row');
// });
}
}
// Add new entry
else {
console.log("Add new entry");
const itemFind = {
...item,
};
const newWorksheet = [...selectedworkshop.worksheet];
if (key) {
itemFind[key] = e;
newWorksheet.push(itemFind);
selectedworkshop.worksheet = newWorksheet;
this.setState({
selectedworkshop: { ...selectedworkshop, worksheet: [...newWorksheet] },
});
return;
}
if (e.target.name == 'Consolidated Level') {
if (e.target.value == 'Yes') {
itemFind['Entity-Specific'] = null;
itemFind['Country-Specific'] = null;
itemFind['Sector-Specific'] = null;
}
}
itemFind[e.target.name] = e.target.value;
newWorksheet.push(itemFind);
selectedworkshop.worksheet = newWorksheet;
this.setState({
selectedworkshop: { ...selectedworkshop, worksheet: [...newWorksheet] },
});
console.log("answeredTopics in state", answeredTopics)
const newAnswered = Array.from(answeredTopics || []);
console.log("newAnswered", newAnswered)
const answerData = newAnswered.find(ans => ans.id === item.id);
console.log("answerData", answerData)
console.log("itemFind", itemFind)
if (answerData) {
answerData[e.target.name] = e.target.value; doubt
console.log('5');
this.setState({
answeredTopics: newAnswered,
});
addAnsweredTopicComment({
surveyId,
consultantId,
}, itemFind)
.then(response => {
console.log('Added new comment', response);
})
.catch(error => {
console.log('error adding new row');
});
// const matrixWorkshopsRef = firebase
// .firestore()
// .collection(this.state.consultantId ? 'portfolio-surveys-consultants' : 'surveys')
// .doc(this.state.surveyId ? this.state.surveyId : this.state.currentSurveyId);
// matrixWorkshopsRef
// .update({
// answeredTopics: newAnswered,
// })
// .then(() => {
// console.log(`Added new row`);
// })
// .catch(error => {
// console.log('error adding new row');
// });
}
}
};
confirmdeleteworkshop = async () => {
const { surveyId, currentSurveyId, consultantId, workshops, workshopdata } = this.state;
this.setState({
showdeleteworkshopmodal: false,
loading: true,
});
try {
// Delete workshop if already present
if (workshopdata && workshopdata.id) {
// await firebase
// .firestore()
// .collection(consultantId ? 'portfolio-surveys-consultants' : 'surveys')
// .doc(surveyId ? surveyId : currentSurveyId)
// .collection('workshops')
// .doc(workshopdata.id)
// .delete()
// .then(() => {
// this.handleAddAuditLog(
// 'delete',
// this.state.assessmentType,
// 'Assessment',
// `${this.state.user.name} deleted the worksheet of ${workshopdata['Name of Person']} (${workshopdata.id})`,
// 'worksheet',
// );
// });
// Delete existing workshop
const response = await removeWorkshop("workshop", {
surveyId: surveyId,
consultantId: consultantId,
workshopId: workshopdata.id,
});
this.handleAddAuditLog(
'delete',
this.state.assessmentType,
'Assessment',
`${this.state.user.name} deleted the worksheet of ${workshopdata['Name of Person']} (${workshopdata.id})`,
'worksheet',
);
const deleteIndex = workshops.findIndex(item => item.id == workshopdata.id);
workshops.splice(deleteIndex, 1);
this.setState({
loading: false,
workshopdata: {},
workshops: [...workshops],
});
}
} catch (ex) {
console.log(ex.message);
this.setState({
loading: false,
workshopdata: {},
});
}
};
confirmdeletefinancialworkshop = async () => {
const {
surveyId,
currentSurveyId,
consultantId,
financialworkshops,
financialworkshopdata,
} = this.state;
this.setState({
showdeletefinancialworkshopmodal: false,
loading: true,
});
try {
if (financialworkshopdata && financialworkshopdata.id) {
// await firebase
// .firestore()
// .collection(consultantId ? 'portfolio-surveys-consultants' : 'surveys')
// .doc(surveyId ? surveyId : currentSurveyId)
// .collection('financial-workshops')
// .doc(financialworkshopdata.id)
// .delete()
// .then(() => {
// this.handleAddAuditLog('delete', this.state.assessmentType, 'Assessment', `${this.state.user.name} deleted the worksheet of ${financialworkshopdata['Name of Person']} (${financialworkshopdata.id})`, 'worksheet');
// })
const response = await removeWorkshop("financial", {
surveyId: surveyId,
consultantId: consultantId,
workshopId: financialworkshopdata.id
});
if (response.status === 200) {
this.handleAddAuditLog(
'delete',
this.state.assessmentType,
'Assessment',
`${this.state.user.name} deleted the worksheet of ${financialworkshopdata['Name of Person']} (${financialworkshopdata.id})`,
'worksheet',
);
}
const deleteIndex = financialworkshops.findIndex(
item => item.id == financialworkshopdata.id,
);
financialworkshops.splice(deleteIndex, 1);
this.setState({
loading: false,
financialworkshopdata: {},
financialworkshops: [...financialworkshops],
});
}
} catch (ex) {
console.log(ex.message);
this.setState({
loading: false,
financialworkshopdata: {},
});
}
};
handleSubmitFinancialWorkshop = async e => {
const {
financialworkshops,
financialworkshopdata,
surveyId,
currentSurveyId,
consultantId,
} = this.state;
// const matrixFinancialWorkshopsRef = firebase
// .firestore()
// .collection(consultantId ? 'portfolio-surveys-consultants' : 'surveys')
// .doc(surveyId ? surveyId : currentSurveyId)
// .collection('financial-workshops');
e.preventDefault();
this.setState({
loading: true,
financialWorkshopTabIndex: 0,
});
const formatDate = (date) => {
if (!date) return null;
const d = date.seconds ? new Date(date.seconds * 1000 + date.nanoseconds / 1000000) : new Date(date);
const month = ('0' + (d.getMonth() + 1)).slice(-2);
const day = ('0' + d.getDate()).slice(-2);
const year = d.getFullYear();
return `${month}/${day}/${year}`;
};
try {
// Edit condition (if id exists)
if (financialworkshopdata.id) {
// const docRef = matrixFinancialWorkshopsRef.doc(financialworkshopdata.id);
// const docSnapshot = await docRef.get();
// const oldData = docSnapshot.data();
const workshopData = await getWorkshopById("financial-workshops", {
surveyId: surveyId,
consultantId: consultantId,
id: financialworkshopdata.id,
});
const oldData = workshopData.data();
const _date = financialworkshopdata['Date of Workshop or Interview'];
const payload = {
...financialworkshopdata,
answeredEntries: financialworkshopdata?.answeredEntries ? financialworkshopdata?.answeredEntries : [],
['Date of Workshop or Interview']:
_date && _date.seconds
? new Date(_date.seconds * 1000 + _date.nanoseconds / 1000000)
: _date,
date: new Date(),
};
// await matrixFinancialWorkshopsRef.doc(financialworkshopdata.id).update(payload)
// )
await updateFinancialWorkshops(consultantId, financialworkshopdata.id, payload)
const changes = [];
// const oldDateFormatted = formatDate(oldData['Date of Workshop or Interview']);
// const newDateFormatted = formatDate(financialworkshopdata['Date of Workshop or Interview']);
const oldDateFormatted = oldData['Date of Workshop or Interview'];
const newDateFormatted = financialworkshopdata['Date of Workshop or Interview'];
if (financialworkshopdata['Name of Person'] !== oldData['Name of Person']) {
changes.push(`Name of Person changed from ${oldData['Name of Person']} to ${financialworkshopdata['Name of Person']}`);
}
if (financialworkshopdata['Stakeholder Type'] !== oldData['Stakeholder Type']) {
changes.push(`Stakeholder Type changed from ${oldData['Stakeholder Type']} to ${financialworkshopdata['Stakeholder Type']}`);
}
if (financialworkshopdata['Type'] !== oldData['Type']) {
changes.push(`Type changed from ${oldData['Type']} to ${financialworkshopdata['Type']}`);
}
if (financialworkshopdata['Interviewer Name'] !== oldData['Interviewer Name']) {
changes.push(`Interviewer Name changed from ${oldData['Interviewer Name']} to ${financialworkshopdata['Interviewer Name']}`);
}
if (newDateFormatted !== oldDateFormatted) {
changes.push(`Date of Workshop or Interview changed from ${oldDateFormatted} to ${newDateFormatted}`);
}
if (financialworkshopdata['Comments'] !== oldData['Comments']) {
const oldcomment = oldData['Comments'] || 'Blank';
changes.push(`Comments changed from ${oldcomment} to ${financialworkshopdata['Comments']}`);
}
if (financialworkshopdata['Recommendations'] !== oldData['Recommendations']) {
const oldrec = oldData['Recommendations'] || 'Blank';
changes.push(`Recommendations changed from ${oldrec} to ${financialworkshopdata['Recommendations']}`);
}
this.handleAddAuditLog(
'update',
this.state.assessmentType,
'Assessment',
`${this.state.user.name} Updated worksheet of ${financialworkshopdata['Name of Person']} (${financialworkshopdata.id}) : ${changes} `,
'worksheet',
);
const index = financialworkshops.findIndex(item => item.id == financialworkshopdata.id);
financialworkshops[index] = payload;
this.setState({
loading: false,
financialworkshopdata: {},
financialworkshops: [...financialworkshops],
selectedfinancialworkshop: payload,
showfinancialworkshopmodal: false,
});
return;
}
// Add new financial Workshop
const payload = {
...financialworkshopdata,
['Date of Workshop or Interview']:
financialworkshopdata['Date of Workshop or Interview'] || new Date(),
companyId: this.state.companyId,
surveyId: surveyId,
worksheet: [],
date: new Date(),
};
// const { id } = await matrixFinancialWorkshopsRef.add(payload);
const response = await setFinancialWorkshops(consultantId, payload)
const answeredTopics = this.sortAnsweredTopics(this.state.answeredTopics || []);
const payloadfinal = {
...payload,
id: response.data.data.id,
worksheet:
payload.worksheet && payload.worksheet.length > 0
? payload.worksheet
: answeredTopics.map(itm => ({ ...itm, 'Scoring Comments': '' })),
};
this.handleAddAuditLog(
'add',
this.state.assessmentType,
'Assessment',
`${this.state.user.name} added worksheet for ${payloadfinal['Name of Person']} (${payloadfinal.id})`,
'worksheet',
);
financialworkshops.push(payloadfinal);
this.setState({
loading: false,
financialworkshopdata: {},
financialworkshops: [...financialworkshops],
showfinancialworkshopmodal: false,
selectedfinancialworkshop: payloadfinal,
financialWorkshopViewIndex: 1,
answeredTopics: answeredTopics.map(itm => ({ ...itm, 'Scoring Comments': '' })),
});
} catch (ex) {
console.log(ex.message);
this.setState({
loading: false,
financialworkshopdata: {},
showfinancialworkshopmodal: false,
});
}
};
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);
int a;
cin >> a;
string n;
cin >> n;
int A = 0;
int B = 0;
for(int i =0; i < n.size(); i++){
if(n[i] == 'a'){
A = A + 1;
}
if(n[i] == 'b'){
B = B + 1;
}
}
cout << A << " " << B << " ";
cout << n.size() / 2 - min(A,B);
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);
int l;
int r;
int x;
cin >> l >> r >> x;
int ans = 1;
int count = 0;
while(ans <= r){
if(ans >= r && ans <= r){
cout << ans << " ";
count = count + 1;
}
ans *= x;
}
if(count == 0){
cout << "-1";
}
return 0;
}
import java.util.Arrays;
import java.util.Scanner;
class Job {
int id;
int deadline;
int profit;
Job(int id, int deadline, int profit) {
this.id = id;
this.deadline = deadline;
this.profit = profit;
}
}
public class JobScheduling {
public static void scheduleJobs(Job[] jobs) {
// Sort jobs based on profit in descending order
Arrays.sort(jobs, (a, b) -> b.profit - a.profit);
// Find the maximum deadline
int maxDeadline = 0;
for (Job job : jobs) {
if (job.deadline > maxDeadline) {
maxDeadline = job.deadline;
}
}
// Create a slot array based on maximum deadline
boolean[] slot = new boolean[maxDeadline];
int[] result = new int[maxDeadline];
for (Job job : jobs) {
// Find a free slot for this job
for (int j = Math.min(maxDeadline - 1, job.deadline - 1); j >= 0; j--) {
if (!slot[j]) {
slot[j] = true;
result[j] = job.id;
break;
}
}
}
// Output the scheduled jobs
System.out.println("Scheduled Jobs:");
for (int jobId : result) {
if (jobId != 0) {
System.out.print(jobId + " ");
}
}
System.out.println();
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter number of jobs: ");
int n = sc.nextInt();
Job[] jobs = new Job[n];
System.out.println("Enter jobs (id, deadline, profit):");
for (int i = 0; i < n; i++) {
int id = sc.nextInt();
int deadline = sc.nextInt();
int profit = sc.nextInt();
jobs[i] = new Job(id, deadline, profit);
}
scheduleJobs(jobs);
sc.close();
}
}
handleSubmitWorkshop = async e => {
const { workshops, workshopdata, surveyId, currentSurveyId, consultantId } = this.state;
// const matrixWorkshopsRef = firebase
// .firestore()
// .collection(consultantId ? 'portfolio-surveys-consultants' : 'surveys')
// .doc(surveyId ? surveyId : currentSurveyId)
// .collection('workshops'); // -->
e.preventDefault();
this.setState({
loading: true,
workshopTabIndex: 0,
});
const formatDate = (date) => {
if (!date) return null;
const d = date.seconds ? new Date(date.seconds * 1000 + date.nanoseconds / 1000000) : new Date(date);
const month = ('0' + (d.getMonth() + 1)).slice(-2);
const day = ('0' + d.getDate()).slice(-2);
const year = d.getFullYear();
return `${month}/${day}/${year}`;
};
try {
// Edit condition (check if id present in the current workshop displayed in the UI)
if (workshopdata.id) {
// const docRef = matrixWorkshopsRef.doc(workshopdata.id); // -->
// const docSnapshot = await docRef.get(); // -->
// const oldData = docSnapshot.data(); // -->
// console.log("old data from firebase", oldData);
const workshopData = await getWorkshopById("workshops", {
surveyId: surveyId,
consultantId: consultantId,
id: workshopdata.id,
},)
console.log("workshopdata", workshopData);
// Get previous data from the workshops collection in DB
const oldData = workshopData.data();
const _date = workshopdata['Date of Workshop or Interview'];
const payload = {
...workshopdata,
answeredEntries: workshopdata?.answeredEntries ? workshopdata?.answeredEntries : [],
['Date of Workshop or Interview']:
_date && _date.seconds
? new Date(_date.seconds * 1000 + _date.nanoseconds / 1000000)
: _date,
};
// await matrixWorkshopsRef.doc(workshopdata.id).update(payload) // --> Replace with API call
console.log("payload", payload);
const response = await updateWorkshops(consultantId, workshopdata.id, payload);
console.log("Response after editing workshop", response);
const changes = [];
// const oldDateFormatted = formatDate(oldData['Date of Workshop or Interview']);
// const newDateFormatted = formatDate(workshopdata['Date of Workshop or Interview']);
const oldDateFormatted = oldData['Date of Workshop or Interview'];
const newDateFormatted = workshopdata['Date of Workshop or Interview'];
if (workshopdata['Name of Person'] !== oldData['Name of Person']) {
changes.push(`Name of Person changed from ${oldData['Name of Person']} to ${workshopdata['Name of Person']}`);
}
if (workshopdata['Stakeholder Type'] !== oldData['Stakeholder Type']) {
changes.push(`Stakeholder Type changed from ${oldData['Stakeholder Type']} to ${workshopdata['Stakeholder Type']}`);
}
if (workshopdata['Type'] !== oldData['Type']) {
changes.push(`Type changed from ${oldData['Type']} to ${workshopdata['Type']}`);
}
if (workshopdata['Interviewer Name'] !== oldData['Interviewer Name']) {
changes.push(`Interviewer Name changed from ${oldData['Interviewer Name']} to ${workshopdata['Interviewer Name']}`);
}
if (newDateFormatted !== oldDateFormatted) {
changes.push(`Date of Workshop or Interview changed from ${oldDateFormatted} to ${newDateFormatted}`);
}
if (workshopdata['Comments'] !== oldData['Comments']) {
const oldcomment = oldData['Comments'] || 'Blank';
changes.push(`Comments changed from ${oldcomment} to ${workshopdata['Comments']}`);
}
if (workshopdata['Recommendations'] !== oldData['Recommendations']) {
const oldrec = oldData['Recommendations'] || 'Blank';
changes.push(`Recommendations changed from ${oldrec} to ${workshopdata['Recommendations']}`);
}
this.handleAddAuditLog(
'update',
this.state.assessmentType,
'Assessment',
`${this.state.user.name} Updated worksheet of ${workshopdata['Name of Person']} (${workshopdata.id}) : ${changes} `,
'worksheet',
);
const index = workshops.findIndex(item => item.id == workshopdata.id);
workshops[index] = payload;
this.setState({
loading: false,
workshopdata: {},
workshops: [...workshops],
selectedworkshop: payload,
showworkshopmodal: false,
});
return;
}
// Add new workshop functionality
const payload = {
...workshopdata,
['Date of Workshop or Interview']:
workshopdata['Date of Workshop or Interview'] || new Date(),
companyId: this.state.companyId,
surveyId: surveyId,
worksheet: [],
date: new Date(),
};
// const { id } = await matrixWorkshopsRef.add(payload);
// Submit new workshop to DB
const response = await setWorkshops(consultantId, payload);
const answeredTopics = this.sortAnsweredTopics(this.state.answeredTopics || []);
const payloadfinal = {
...payload,
id: response.data.data.id, // Find out what to enter here instead of id from firebase add call
// id,
worksheet:
payload.worksheet && payload.worksheet.length > 0
? payload.worksheet
: answeredTopics.map(itm => ({ ...itm, 'Scoring Comments': '' })),
};
console.log("payloadfinal", payloadfinal);
this.handleAddAuditLog(
'add',
this.state.assessmentType,
'Assessment',
`${this.state.user.name} added worksheet for ${payloadfinal['Name of Person']} (${payloadfinal.id})`,
'worksheet',
);
workshops.push(payloadfinal);
console.log("workshops", workshops);
this.setState({
loading: false,
workshopdata: {},
workshops: [...workshops],
showworkshopmodal: false,
selectedworkshop: payloadfinal,
workshopViewIndex: 1,
answeredTopics: answeredTopics.map(itm => ({ ...itm, 'Scoring Comments': '' })),
});
} catch (ex) {
console.log(ex?.message);
this.setState({
loading: false,
workshopdata: {},
showworkshopmodal: false,
});
}
};
handleSubmitTabComment = async (e, type) => {
e.preventDefault();
this.setState({ loading: true });
const allComments = Array.from(this.state.comments);
const newComment = {
date: new Date(),
user: {
name: this.state.user.username || this.state.user.name || 'N/A',
companyId: this.state.user.companyId || 'N/A',
id: this.state.user.id || 'N/A',
email: this.state.user.email || 'N/A',
},
comment: this.state.tabcommentvalue,
type: type,
};
allComments.push(newComment);
allComments.sort((a, b) => new Date(b.date) - new Date(a.date));
const { surveyId, currentSurveyId, consultantId } = this.state;
// axios(this.postOptions(postUrl, newComment))
addComment(
{
surveyId,
consultantId,
},
newComment,
)
.then(response => {
console.log('submitted response', response);
this.setState({
loading: false,
showtabcommentmodal: {
open: false,
type: '',
},
tabcommentvalue: '',
tabComments: allComments,
});
const summary = `${this.state.user.name} Added new comment ${newComment.comment}`;
this.handleAddAuditLog(
'add',
this.state.assessmentType,
'Assessment',
summary,
'Tab Comment',
);
})
.catch(error => {
this.setState({
loading: false,
showtabcommentmodal: {
open: false,
type: '',
},
tabcommentvalue: '',
tabComments: allComments,
});
});
};
getSurveys = async (
surveyId,
filterByStakeholderTypeValue,
filterByCountryValue,
filterByContinentValue,
consultantId,
) => {
try {
const { assessmentType } = this.state;
// Fetch survey details
const surveyDetails = await getbysurveyid(surveyId, consultantId);
const survey = surveyDetails.data();
console.log("survey", survey);
const submittedSurveyResults = await getsubmittedSurveyResult(surveyId, consultantId);
const tabComments = survey["tab-comments"] || [];
const surveyConditions = () => (Object.keys(survey).length > 0 && survey?.approvedTopics) ? survey?.approvedTopics : false;
const workshops = await getSurveyResultForSubcollection(surveyId, consultantId, 'workshops')
const financialWorkshops = await getSurveyResultForSubcollection(surveyId, consultantId, 'financial-workshops')
// this.setState({
// survey: { ...survey, id: survey.id },
// // loading: false,
// });
// Object to hold all state changes to schedule the state updations
const newState = {}
console.log("newState 1", newState)
newState.survey = { ...survey, id: survey.id }
if (survey.answeredTopics) {
let allTopics = survey?.surveyTopicsShort
? [
...survey.surveyTopicsShort.business,
...survey.surveyTopicsShort.social,
...survey.surveyTopicsShort.human,
...survey.surveyTopicsShort.environment,
...survey.surveyTopicsShort.leadership,
]
: [];
newState.materialityAssessmentTopics = survey.answeredTopics;
newState.financialConsolidatedReports = [...survey.answeredTopics, ...allTopics]
.filter((v, i, a) => a.findIndex(t => t.topic === v.topic && t.id === v.id) === i)
.filter(item => item.entryType !== 'comment' && item.entryType !== 'added-entry')
.sort((a, b) => {
if (a.framework == 'CSRD') {
let _a =
CSRDAllTopics?.find(
item2 => item2['mainId'] == a['mainId'] && item2['topic'] == a['topic'],
)?.sortIndex || 0;
let _b =
CSRDAllTopics?.find(
item2 => item2['mainId'] == b['mainId'] && item2['topic'] == b['topic'],
)?.sortIndex || 0;
return _a < _b ? -1 : _a > _b ? 1 : 0;
}
if (a.framework == 'GRI') {
let _a = a.id;
let _b = b.id;
return _a < _b ? -1 : _a > _b ? 1 : 0;
}
if (a.topic < b.topic) return -1;
if (a.topic > b.topic) return 1;
})
?.sort((a, b) => {
if (a.isCustom || b.isCustom) {
// Move objects with 'isCustom' property to the end
if (a.isCustom && !b.isCustom) {
return 1;
} else if (!a.isCustom && b.isCustom) {
return -1;
} else {
// If both have 'isCustom' or neither have 'isCustom', sort by customSortId
if (a.customSortId && b.customSortId) {
return a.customSortId > b.customSortId ? 1 : -1;
} else {
return a.topic > b.topic ? 1 : -1;
}
}
}
})
.sort((a, b) => {
if (this.renderESG(a.dimension) == 'Environmental') return -1;
if (this.renderESG(b.dimension) == 'Environmental') return 1;
if (this.renderESG(a.dimension) == 'Social') return -1;
if (this.renderESG(b.dimension) == 'Social') return 1;
if (this.renderESG(a.dimension) == 'Governance') return -1;
if (this.renderESG(b.dimension) == 'Governance') return 1;
if (this.renderESG(a.dimension) < this.renderESG(b.dimension)) return -1;
if (this.renderESG(a.dimension) > this.renderESG(b.dimension)) return 1;
})
.sort((a, b) => {
if (this.renderESG(a.dimension) == 'Environmental') return -1;
if (this.renderESG(b.dimension) == 'Environmental') return 1;
if (this.renderESG(a.dimension) == 'Social') return -1;
if (this.renderESG(b.dimension) == 'Social') return 1;
if (this.renderESG(a.dimension) == 'Governance') return -1;
if (this.renderESG(b.dimension) == 'Governance') return 1;
if (this.renderESG(a.dimension) < this.renderESG(b.dimension)) return -1;
if (this.renderESG(a.dimension) > this.renderESG(b.dimension)) return 1;
});
newState.allTopics = allTopics;
newState.answeredTopics = survey.answeredTopics
? [...survey.answeredTopics, ...allTopics].filter(
(v, i, a) => a.findIndex(t => t.topic === v.topic && t.id === v.id) === i,
)
: [];
newState.addedCommentTopics = Array.from(survey.addedCommentTopics || []);
} else {
// this.setState({ loading: false });
}
const properties = {
impactMaterialityMethodology: true,
impactMaterialityScoringMethodology: true,
financialMaterialityMethodology: true,
financialMaterialityScoringMethodology: true,
financialMappingMethodology: true,
materialityAssessmentTopics: true,
verifiedTopics: true,
scoringSetting: true,
reasonForMaxOrAverage: true,
isNotFirstTimeOpeningImpactWorksheet: true,
isNotFirstTimeOpeningFinancialWorksheet: true
};
for (const key in properties) {
if (survey[key] !== undefined) {
newState[key] = survey[key];
}
}
// Default value for stakeholderTypes
newState.stakeholderTypes = survey.stakeholderTypes || _stakeholderTypes;
const getProperDate = date => {
if (date.toDate) {
return date.toDate();
} else {
return date;
}
};
// Survey List operations
this.handleSubmittedSurveyListOperation(submittedSurveyResults, surveyConditions)
const workshopList = workshops.map(workshop => {
return {
...workshop,
id: workshop.id,
answeredEntries: workshop?.['answeredEntries']?.map(itm => ({
...itm,
Scale: itm['Scale'] == '0 - None' ? '1 - Minimal' : itm['Scale'] || '',
Scope: itm['Scope'] == '0 - No impact' ? '1 - Limited' : itm['Scope'] || '',
Likelihood:
itm['Likelihood'] ==
'0 - Very Unlikely (Has not occurred, and the possible chance of occuring is low)'
? '1 - Rare'
: itm['Likelihood'] || '',
Remediability:
itm['Remediability'] == '0 - Very Easy to remedy'
? '1 - Relatively easy to remedy'
: itm['Remediability'] || '',
})),
};
});
const financialWorkshopList = financialWorkshops.map(workshop => ({
...workshop,
id: workshop.id,
answeredEntries: workshop?.['answeredEntries']?.map(itm => ({
...itm,
Likelihood:
itm['Likelihood'] ==
'0 - Very Unlikely (Has not occurred, and the possible chance of occuring is low)'
? '1 - Rare'
: itm['Likelihood'] || '',
Magnitude:
itm['Magnitude'] == '0 - Not material (0%)'
? '1 - Minimal Impact'
: itm['Magnitude'] || '',
})),
}));
const tabCommentsList = tabComments.map(comment => {
if (!comment.comment) return; // Workaround for damaged data --> remove once data is changed from DB
return {
...comment,
id: comment.id,
// date: getProperDate(comment.date)
date: comment.date.toDate ? comment.date.toDate() : comment.date,
};
});
newState.workshops = workshopList
newState.financialworkshops = financialWorkshopList
newState.tabComments = tabCommentsList
newState.loading = false
console.log("newState", newState);
this.setState(newState);
} catch (ex) {
this.setState({ loading: false });
}
};
#wpgs-gallery.wcgs-woocommerce-product-gallery .wcgs-carousel {
max-width: 100%;
}
<!DOCTYPE html>
<html>
<head>
<title>Event Count</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #fdf2e9;
}
.container {
background-color: #fcefe3;
width: 400px;
padding: 20px;
border: 1px solid #ccc;
margin: 100px auto;
text-align: center;
}
h2 {
text-align: center;
}
input {
margin-bottom: 10px;
padding: 5px;
width: 200px;
}
button {
padding: 10px 20px;
font-size: 14px;
cursor: pointer;
}
#result {
margin-top: 20px;
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<h2>Event count for a month</h2>
<label for="event1">Birthday party event :</label>
<input type="number" id="event1"><br>
<label for="event2">Engagement parties event :</label>
<input type="number" id="event2"><br>
<label for="event3">Corporate event :</label>
<input type="number" id="event3"><br>
<label for="event4">Social Gathering event :</label>
<input type="number" id="event4"><br>
<button id="button" onclick="maxevent()">Submit</button>
<div id="result"></div>
</div>
<script>
function maxevent() {
// Getting event counts
var event1 = parseInt(document.getElementById('event1').value) || 0;
var event2 = parseInt(document.getElementById('event2').value) || 0;
var event3 = parseInt(document.getElementById('event3').value) || 0;
var event4 = parseInt(document.getElementById('event4').value) || 0;
// Finding the maximum event count
var maxCount = Math.max(event1, event2, event3, event4);
// Displaying the result
var resultDiv = document.getElementById('result');
if (maxCount === event1) {
resultDiv.innerHTML = "Maximum number of event occurred in this month is Birthday party";
} else if (maxCount === event2) {
resultDiv.innerHTML = "Maximum number of event occurred in this month is Engagement parties";
} else if (maxCount === event3) {
resultDiv.innerHTML = "Maximum number of event occurred in this month is Corporate";
} else if (maxCount === event4) {
resultDiv.innerHTML = "Maximum number of event occurred in this month is Social Gathering";
}
}
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 50px;
text-align: center;
}
input {
margin: 10px;
padding: 10px;
width: 80px;
}
button {
padding: 10px 20px;
margin: 5px;
}
#result {
margin-top: 20px;
font-size: 20px;
font-weight: bold;
}
</style>
</head>
<body>
<h3>Simple Calculator</h3>
<input type="number" id="value1" placeholder="Value 1">
<input type="number" id="value2" placeholder="Value 2"><br>
<button name="add" onclick="add()">ADDITION</button>
<button name="sub" onclick="sub()">SUBTRACT</button>
<button name="mul" onclick="mul()">MULTIPLY</button>
<button name="div" onclick="div()">DIVISION</button>
<div id="result"></div>
<script>
function add() {
const value1 = parseFloat(document.getElementById("value1").value);
const value2 = parseFloat(document.getElementById("value2").value);
document.getElementById("result").innerText = "Addition of " + value1 + " and " + value2 + " is " + (value1 + value2);
}
function sub() {
const value1 = parseFloat(document.getElementById("value1").value);
const value2 = parseFloat(document.getElementById("value2").value);
document.getElementById("result").innerText = "Subtraction of " + value1 + " and " + value2 + " is " + (value1 - value2);
}
function mul() {
const value1 = parseFloat(document.getElementById("value1").value);
const value2 = parseFloat(document.getElementById("value2").value);
document.getElementById("result").innerText = "Multiplication of " + value1 + " and " + value2 + " is " + (value1 * value2);
}
function div() {
const value1 = parseFloat(document.getElementById("value1").value);
const value2 = parseFloat(document.getElementById("value2").value);
if (value2 === 0) {
document.getElementById("result").innerText = "Error: Division by zero";
} else {
document.getElementById("result").innerText = "Division of " + value1 + " and " + value2 + " is " + (value1 / value2);
}
}
</script>
</body>
</html>
Flow version:
HYPERLINK(LEFT($Api.Enterprise_Server_URL_610, FIND( '/services', $Api.Enterprise_Server_URL_610)) & {!$Record.AccountId}, {!$Record.Account.Name})
Forula version:
HYPERLINK(LEFT($Api.Enterprise_Server_URL_610, FIND( '/services', $Api.Enterprise_Server_URL_610)) & AccountId, Account.Name)
mô hình động học phân tử về cấu tạo chất các chất đều được cấu tạo từ phân tử nguyên tử các phân tử chuyển động không ngừng nhiệt độ càng cao chuyển động càng nhanh giữa các phân tử có các lực hút đẩy gọi là lực liên kết các phân tử 1. Chất Rắn: Khoảng cách: Gần nhau. Sự sắp xếp: Đều đặn, cấu trúc tinh thể. Chuyển động: Rung động tại chỗ. 2. Chất Lỏng: Khoảng cách: Xa hơn rắn nhưng gần nhau. Sự sắp xếp: Không cố định, linh hoạt. Chuyển động: Di chuyển và trượt qua nhau. 3. Chất Khí: Khoảng cách: Rất xa nhau. Sự sắp xếp: Không cố định, phân tán. Chuyển động: Di chuyển nhanh và tự do. 1. chất rắn khoảng cách rất gần có sự sắp xếp và cấu trúc dao động quanh vị trí cân bằng cố định 2. chất lỏng khoảng cách xa hơn chất rắn nhưng vẫn gần nhau sự sắp xếp, linh hoạt không cố định di chuyển xung quanh một vị trí cân bằng 3. chất khí khoảng cách: rất xa nhau sự sắp xếp: phân tán loạn xạ chuyển động tự do và hỗn loạn chất rắn phân tử có sự sắp xếp chặt chẽ phân tử ở rất gần nhau di chuyển xung quanh một vị trí cân bằng cố định chất lỏng khoảng cách xa hơn chất rắn nhưng vẫn gần nhau có sự sắp xếp theo cấu trúc nhưng linh hoạt hơn chất răns di chuyển xung quanh vị trí cân bằng không cố định chất khí khoảng cách rất xa nhau di chuyển hỗn loạn tự do mô hình động học của các phân tử mô hình động học của các phân tư r mô hình động học của các phân tử các chất đều được tạo nên từ các nguyên tử các chất di chuyển không ngừng nhiệt độ càng tăng di chuyển càng nhanh giữa các phân tử có các lực hút đẩy gọi là lực liên kết phân tử sự chuyển thể rắn lỏng nóng chảy rắn khí thăng hoa lỏng sang rắn đông đặc lỏng khí hóa hơi khí rắn ngưng kết khí lỏng ngưng tụ sự bay hơi xảy ra ở bất kì nhiệt độ nào ở trên bề mặt thoáng của chất lỏng các phân tử di chuyển liên tục có thể vô tình va vào nhau và truyền năng lượng cho nhau khi các phân tử ở gần mặt thoáng nhận đủ năng lượng nó có thể thắng được lực liên kết phân tử từ đó thoát ra khỏi chất lỏng và chuyển thành thể khí sự sôi là sự bay hơi nhưng xảy ra cả ở bề mặt thoáng lẫn ở bên trong lòng chất lỏng trong lúc sôi nhiệt độ của chất ko thay đổi năng lượng sẽ được truyền cho các phân tử lỏng chưa bay hơi cho đến khi chúng bay hơi hết sự nóng chảy của chất rắn kết tinh Sự nóng chảy của chất rắn kết tinh: Khái niệm: Là quá trình chất rắn kết tinh chuyển thành chất lỏng khi được làm nóng. Quá trình: Khi nhiệt độ tăng, các phân tử trong chất rắn kết tinh được cung cấp đủ năng lượng để phá vỡ cấu trúc tinh thể, từ đó chất rắn chuyển thành chất lỏng. Điểm nóng chảy: Đây là nhiệt độ tại đó chất rắn kết tinh bắt đầu chuyển sang trạng thái lỏng. Điểm này là đặc trưng cho mỗi chất và thường rất rõ ràng. Cấu trúc tinh thể: Trong chất rắn kết tinh, các phân tử được sắp xếp theo một cấu trúc lặp lại đều đặn. Khi đạt đến điểm nóng chảy, cấu trúc này bị phá vỡ. Ví dụ: là quá trình chất rắn kết tinh chuyển thành chất lỏng khi được làm nóng quá trình: khi nhiệt độ tăng, các phân tử rắn kết tinh được cung cấp đủ năng lượng để phá vỡ cấu trúc tinh thể từ đó chất rắn chuyển dần thành chất lỏng điểm nóng chảy: đây là nhiệt độ mà tại đó chất rắn kết tinh bắt đầu chuyển sang trạng thái lỏng trong lúc nóng chảy t độ ko thay đổi
#!/bin/bash #################################### # # Rolling 7 day backup to local directory # #################################### mysqldump_location="path_to_place_mysql_dump_file" /usr/bin/mysqldump --opt your_database_name --single-transaction --default-character-set=utf8mb4 > $mysqldump_location/your_dump_file_name.SQL # What to backup. backup_files="path_to_your_website_directory" # Where to backup to. dest="path_to_place_your_backup_files" # Create archive filename. day=$(date +%A) hostname=$(hostname -s) archive_file="your_domain_name-$day.zip" # Backup the files using zip. zip -r $dest/$archive_file $backup_files rm -f $mysqldump_location/your_dump_file.SQL
<!-- Row --> <div class="row"> <!-- Column --> <div class="col-md-6"> <p>TEXT</p> </div> <!-- Column --> <div class="col-md-6"> <p>TEXT</p> </div> </div>
import random
number = random.randint(1, 6)
guess = 0
while guess != number:
guess = int(input('Number : '))
if guess == number:
print('You won ;)')
<p class="text-align-center">
<a class="btn btn-primary btn-lg" href="###" role="button">Button text</a>
</p>
void Download_Medical_Certificate(string Recid_Medical_Certificate, string Medical_Certificate)
{
if(Medical_Certificate != "")
{
path2 = Medical_Certificate.get(0).get("path");
info "Path:" + path2;
download_Medical_Certificate1 = invokeurl
[
url :path2
type :GET
connection:"developerforms"
];
info "DOWNLOAD: " + download_Medical_Certificate1;
download_Medical_Certificate1.setParamName("file");
info download_Medical_Certificate1;
attach_file = invokeurl
[
url :"https://www.zohoapis.com/crm/v3/Medical_Certificates/" + Recid_Medical_Certificate + "/Attachments"
type :POST
files:download_Medical_Certificate1
connection:"zoho_claim_shield_crm_connection"
];
info "Attaching files = " + attach_file;
}
}
void EFT_billing_update(int reqid)
{
get_doc_details = invokeurl
[
url :"https://sign.zoho.com/api/v1/requests/" + reqid + ""
type :GET
connection:"zoho_sign"
];
//info get_doc_details;
resp = get_doc_details.get("requests");
//info resp;
document_ids = resp.get("document_ids");
//info document_ids;
document_fields = resp.get("document_fields");
//info document_fields;
for each data in document_fields
{
fields = data.get("fields");
//info fields;
for each fields in fields
{
field_label = fields.get("field_label");
//info field_label;
if(field_label.contains("Company"))
{
//field_id = fields.get("field_id");
//info field_id;
Client_name = fields.get("field_value");
info Client_name;
}
}
}
for each rec in document_ids
{
document_name = rec.get("document_name");
//info document_name;
if(document_name.contains("ClaimShield EFT Form"))
{
document_id = rec.get("document_id");
//info document_id;
downloadpdf = invokeurl
[
url :"https://sign.zoho.com/api/v1/requests/" + reqid + "/documents/" + document_id + "/pdf"
type :GET
connection:"zoho_sign"
];
//info downloadpdf;
}
}
//////done "rajausman1313@gmail.com"
sendmail
[
from :zoho.adminuserid
to :"Billing@claimshieldpro.com"
subject :"New Client Created - " + Client_name + ""
message :"Please find attached EFT document for this client."
Attachments :file:downloadpdf
]
}
//////////////Start Function///////////
Get_All_Employee_Attachments_Response = invokeurl
[
url :"https://www.zohoapis.com/crm/v3/Leads/" + Emp_id + "/Attachments?fields=id,Owner,File_Name,Created_Time,Parent_Id"
type :GET
connection:"zoho_crm2"
];
//info response;
Records = Get_All_Employee_Attachments_Response.get("data");
//For each through all the Attachments returned by the above API call
for each Record in Records
{
File_Name = Record.get("File_Name");
//info File_Name;
if(File_Name.contains("Medical_Certificate"))
{
Attachment_ID = Record.get("id");
Medical_Certificate_File_Name = Record.get("File_Name");
//Below is a logging statement, do not delete
info "Attachment_ID" + Attachment_ID;
}
}
//Call the CRM API to get the actual attachment
////I still am unsure if this is necessary. Since we are already getting all attachments, why do we need to specifically call another time to just get the 1 attachment?
////Doesn't the first call (all Attachments) provide the data we need?
Get_Medical_Certificate_Response = invokeurl
[
url :"https://www.zohoapis.com/crm/v6/Leads/" + Emp_id + "/Attachments/" + Attachment_ID + ""
type :GET
connection:"zoho_crm2"
];
//Below is a logging statement, do not delete
info "Get Medical Certificate Response: " + Get_Medical_Certificate_Response;
//
//Upload to Workdrive
////How is header being used?
header = Map();
header.put("Accept","application/vnd.api+json");
list_of_text = List();
list_of_text.add({"paramName":"filename","content":Medical_Certificate_File_Name,"stringPart":"true"});
list_of_text.add({"paramName":"parent_id","content":wd_folder_id,"stringPart":"true"});
list_of_text.add({"paramName":"override-name-exist","content":"true","stringPart":"true"});
list_of_text.add({"paramName":"content","content":Get_Medical_Certificate_Response,"stringPart":"false"});
Upload_Medical_Certificate_Response = invokeurl
[
url :"https://www.zohoapis.com/workdrive/api/v1/upload"
type :POST
files:list_of_text
connection:"zoho_wd"
];
//Below is a logging statement, do not delete
info "Upload Medical Certificate Response: " + Upload_Medical_Certificate_Response;
/////
response = invokeurl
[
url :"https://www.zohoapis.com/crm/v5/Leads/" + rec_id + "/Attachments?fields=id,Owner,File_Name,Created_Time,Parent_Id"
type :GET
connection:"zoho_crm2"
];
//info response;
resp_data = response.get("data");
//info resp_data;
for each data in resp_data
{
File_Name = data.get("File_Name");
//info File_Name;
if(File_Name.contains("DRIVER APPLICATION"))
{
file_id1 = data.get("id");
info file_id1;
download_response = invokeurl
[
url :"https://www.zohoapis.com/crm/v5/Leads/" + rec_id + "/Attachments/" + file_id1 + ""
type :GET
connection:"zoho_crm2"
];
info download_response;
download_response.setParamName("file");
upload_response = invokeurl
[
url :"https://www.zohoapis.com/crm/v6/files"
type :POST
files:download_response
connection:"zoho_crm2"
];
//info upload_response;
resp_data = upload_response.get("data");
for each rec in resp_data
{
file_id = rec.get("details").get("id");
//info file_id;
}
}
}
finallist = List();
frommp = Map();
frommp.put("email",from_email);
// frommp.put("email","zach.dugger@claimshieldpro.com");
mp = Map();
mp.put("from",frommp);
tomaplist = List();
tomap = Map();
tomap.put("email",manager_email_id);
tomaplist.add(tomap);
//…….Multiple Receiver………
tomap1 = Map();
tomap1.put("email",manager_email_id);
tomaplist.add(tomap1);
mp.put("to",tomaplist);
//..........Get Template Data............
TemplateID = "2314579000150955209";
templatemap = Map();
templatemap.put("id",TemplateID);
mp.put("template",templatemap);
mp.put("org_email",True);
//////
///////
attachmentlist = List();
attachmentmap = Map();
attachmentmap.put("id",file_id);
attachmentlist.add(attachmentmap);
mp.put("attachments",attachmentlist);
///////
finallist.add(mp);
finalmap = Map();
finalmap.put("data",finallist);
//info finallist;
///////
send_mail_resp = invokeurl
[
url :"https://www.zohoapis.com/crm/v5/Leads/" + rec_id + "/actions/send_mail"
type :POST
parameters:finalmap.toString()
connection:"zoho_crm2"
];
info send_mail_resp;
queryMap = Map();
queryMap.put("select_query", "select Account_Name, Company_Movement_Rate from Accounts where Layout = '3251014000167943049' ");
response = invokeurl
[
url :"https://www.zohoapis.com/crm/v3/coql"
type :POST
parameters: queryMap.toString()
connection:"zoho_crm"
];
info response;
global with sharing class BK_FilterCollectionByField {
global class FilterException extends Exception {}
@InvocableMethod(label='Filter Collection By Field')
global static List<Result> filterRecordsByField(List<Request> requests) {
List<Result> results = new List<Result>();
for(Request request : requests) {
// Validate inputs
if (request.allowEmptyCollection != true && (request.inputRecords == null || request.inputRecords.isEmpty())) {
throw new FilterException('Input record collection is required but empty.');
}
if (request.filterValues == null || request.filterValues.isEmpty()) {
throw new FilterException('Filter values are required but empty.');
}
if (String.isBlank(request.fieldAPIName)) {
throw new FilterException('Field to filter by is required but empty.');
}
List<SObject> filteredRecords = new List<SObject>();
if (request.allowEmptyCollection == true && (request.inputRecords == null || request.inputRecords.isEmpty())) {
// Return empty result if allowed
filteredRecords = new List<SObject>{};
} else {
// Prepare the set or list for filter values based on case sensitivity
Set<String> filterValuesSet = new Set<String>();
if(request.caseSensitive == true) {
filterValuesSet.addAll(request.filterValues);
} else {
for(String value : request.filterValues) {
if(value != null) {
filterValuesSet.add(value.toLowerCase());
}
}
}
// Filter records
for(SObject record : request.inputRecords) {
Object fieldValueObj = record.get(request.fieldAPIName);
if(fieldValueObj != null) {
String fieldValue = String.valueOf(fieldValueObj);
if(request.caseSensitive == true) {
if(filterValuesSet.contains(fieldValue)) {
filteredRecords.add(record);
}
} else {
if(filterValuesSet.contains(fieldValue.toLowerCase())) {
filteredRecords.add(record);
}
}
}
}
}
Result result = new Result();
result.filteredRecords = filteredRecords;
results.add(result);
}
return results;
}
global class Request {
@InvocableVariable(label='Input Records' description='Collection of records to filter' required=true)
global List<SObject> inputRecords;
@InvocableVariable(label='Filter Values' description='Collection of string values to filter by' required=true)
global List<String> filterValues;
@InvocableVariable(label='Field API Name' description='API name of the field to filter by' required=true)
global String fieldAPIName;
@InvocableVariable(label='Allow Empty Collection' description='Allow the input record collection to be empty? Default is false')
global Boolean allowEmptyCollection = false;
@InvocableVariable(label='Case Sensitive' description='Perform case-sensitive matching? Default is false')
global Boolean caseSensitive = false;
}
global class Result {
@InvocableVariable(label='Filtered Records' description='Collection of records that match the filter criteria')
global List<SObject> filteredRecords;
}
}
Test class:
@isTest
private class BK_FilterCollectionByFieldTest {
@isTest
static void testFilterRecordsByField() {
// Create sample accounts
Account acc1 = new Account(Name = 'Test Account 1', AccountNumber = '123');
Account acc2 = new Account(Name = 'Test Account 2', AccountNumber = '456');
Account acc3 = new Account(Name = 'Test Account 3', AccountNumber = '789');
insert new List<Account>{acc1, acc2, acc3};
// Prepare request
BK_FilterCollectionByField.Request request = new BK_FilterCollectionByField.Request();
request.inputRecords = new List<SObject>{acc1, acc2, acc3};
request.filterValues = new List<String>{'123', '789'};
request.fieldAPIName = 'AccountNumber';
request.caseSensitive = true;
// Call the method
List<BK_FilterCollectionByField.Result> results = BK_FilterCollectionByField.filterRecordsByField(
new List<BK_FilterCollectionByField.Request>{request}
);
// Assert the results
System.assertEquals(1, results.size(), 'Should return one result object');
System.assertEquals(2, results[0].filteredRecords.size(), 'Should return two filtered records');
Set<Id> expectedIds = new Set<Id>{acc1.Id, acc3.Id};
Set<Id> resultIds = new Set<Id>();
for(SObject sobj : results[0].filteredRecords) {
resultIds.add(sobj.Id);
}
System.assertEquals(expectedIds, resultIds, 'Filtered records should match expected accounts');
}
@isTest
static void testFilterRecordsByField_CaseInsensitive() {
// Create sample accounts with varying case in AccountNumber
Account acc1 = new Account(Name = 'Test Account 1', AccountNumber = 'abc');
Account acc2 = new Account(Name = 'Test Account 2', AccountNumber = 'DEF');
Account acc3 = new Account(Name = 'Test Account 3', AccountNumber = 'GHI');
insert new List<Account>{acc1, acc2, acc3};
// Prepare request
BK_FilterCollectionByField.Request request = new BK_FilterCollectionByField.Request();
request.inputRecords = new List<SObject>{acc1, acc2, acc3};
request.filterValues = new List<String>{'Abc', 'def'};
request.fieldAPIName = 'AccountNumber';
request.caseSensitive = false;
// Call the method
List<BK_FilterCollectionByField.Result> results = BK_FilterCollectionByField.filterRecordsByField(
new List<BK_FilterCollectionByField.Request>{request}
);
// Assert the results
System.assertEquals(1, results.size(), 'Should return one result object');
System.assertEquals(2, results[0].filteredRecords.size(), 'Should return two filtered records');
Set<Id> expectedIds = new Set<Id>{acc1.Id, acc2.Id};
Set<Id> resultIds = new Set<Id>();
for(SObject sobj : results[0].filteredRecords) {
resultIds.add(sobj.Id);
}
System.assertEquals(expectedIds, resultIds, 'Filtered records should match expected accounts');
}
@isTest
static void testFilterRecordsByField_EmptyCollectionAllowed() {
// Prepare request with empty inputRecords
BK_FilterCollectionByField.Request request = new BK_FilterCollectionByField.Request();
request.inputRecords = new List<SObject>();
request.filterValues = new List<String>{'123', '789'};
request.fieldAPIName = 'AccountNumber';
request.allowEmptyCollection = true;
// Call the method
List<BK_FilterCollectionByField.Result> results = BK_FilterCollectionByField.filterRecordsByField(
new List<BK_FilterCollectionByField.Request>{request}
);
// Assert the results
System.assertEquals(1, results.size(), 'Should return one result object');
System.assertEquals(0, results[0].filteredRecords.size(), 'Should return zero filtered records');
}
@isTest
static void testFilterRecordsByField_ExceptionOnEmptyCollection() {
// Prepare request with empty inputRecords
BK_FilterCollectionByField.Request request = new BK_FilterCollectionByField.Request();
request.inputRecords = new List<SObject>();
request.filterValues = new List<String>{'123', '789'};
request.fieldAPIName = 'AccountNumber';
request.allowEmptyCollection = false;
// Call the method and expect exception
try {
List<BK_FilterCollectionByField.Result> results = BK_FilterCollectionByField.filterRecordsByField(
new List<BK_FilterCollectionByField.Request>{request}
);
System.assert(false, 'Expected an exception due to empty inputRecords');
} catch (Exception ex) {
System.assert(ex instanceof BK_FilterCollectionByField.FilterException, 'Expected a FilterException');
System.assertEquals('Input record collection is required but empty.', ex.getMessage());
}
}
@isTest
static void testFilterRecordsByField_ExceptionOnEmptyFilterValues() {
// Create sample accounts
Account acc1 = new Account(Name = 'Test Account 1', AccountNumber = '123');
insert acc1;
// Prepare request with empty filterValues
BK_FilterCollectionByField.Request request = new BK_FilterCollectionByField.Request();
request.inputRecords = new List<SObject>{acc1};
request.filterValues = new List<String>();
request.fieldAPIName = 'AccountNumber';
// Call the method and expect exception
try {
List<BK_FilterCollectionByField.Result> results = BK_FilterCollectionByField.filterRecordsByField(
new List<BK_FilterCollectionByField.Request>{request}
);
System.assert(false, 'Expected an exception due to empty filterValues');
} catch (Exception ex) {
System.assert(ex instanceof BK_FilterCollectionByField.FilterException, 'Expected a FilterException');
System.assertEquals('Filter values are required but empty.', ex.getMessage());
}
}
@isTest
static void testFilterRecordsByField_ExceptionOnEmptyFieldAPIName() {
// Create sample accounts
Account acc1 = new Account(Name = 'Test Account 1', AccountNumber = '123');
insert acc1;
// Prepare request with empty fieldAPIName
BK_FilterCollectionByField.Request request = new BK_FilterCollectionByField.Request();
request.inputRecords = new List<SObject>{acc1};
request.filterValues = new List<String>{'123'};
request.fieldAPIName = '';
// Call the method and expect exception
try {
List<BK_FilterCollectionByField.Result> results = BK_FilterCollectionByField.filterRecordsByField(
new List<BK_FilterCollectionByField.Request>{request}
);
System.assert(false, 'Expected an exception due to empty fieldAPIName');
} catch (Exception ex) {
System.assert(ex instanceof BK_FilterCollectionByField.FilterException, 'Expected a FilterException');
System.assertEquals('Field to filter by is required but empty.', ex.getMessage());
}
}
}
.elementor-sticky--effects {
background: #941841!important;
}
selector.elementor-sticky--effects .elementor-container{
min-height: 80px !important;
}
selector .elementor-container{
transition: all 2s !important;
}
selector.elementor-sticky--effects .my-img img {
width: 90px;
}
selector .my-img img {
transition: 0.4s all;
}
find . -maxdepth 1 -mtime +3900 -printf '%CY-%Cm-%Cd %f\n' | sort
/**
* @NApiVersion 2.1
* @NScriptType Suitelet
*/
var addLineCounterId = 0;
var objLine = {};
var CLIENT_SCRIPT_FILE_ID = 22087;
define(['N/file', 'N/https', 'N/log', 'N/ui/message', 'N/query', 'N/record', 'N/render', 'N/runtime', 'N/ui/serverWidget', 'N/search', 'N/format', 'N/url', 'N/redirect'], main);
function main(fileModule, httpsModule, logModule, messageModule, queryModule, recordModule, renderModule, runtimeModule, serverWidgetModule, searchModule, formatModule, urlModule, redirectModule) {
file = fileModule;
https = httpsModule;
log = logModule;
message = messageModule;
query = queryModule;
record = recordModule;
render = renderModule;
runtime = runtimeModule;
serverWidget = serverWidgetModule;
url = urlModule;
search = searchModule;
format = formatModule;
redirect = redirectModule;
return {
onRequest: function (context) {
try {
var domain = 'https://';
domain += url.resolveDomain({
hostType: url.HostType.FORM,
accountId: runtime.accountId
});
log.debug('domain', domain)
scriptURL = url.resolveScript({
scriptId: runtime.getCurrentScript().id,
deploymentId: runtime.getCurrentScript().deploymentId,
returnExternalUrl: false
}); //returnExternalUrl
log.debug('scriptURL', scriptURL);
var objScript = runtime.getCurrentScript();
backgroundImg = objScript.getParameter({
name: 'custscript_backgroundimg_p2p'
});
log.debug('backgroundImg', backgroundImg);
//scriptURL = 'https://5693072-sb2.extforms.netsuite.com/app/site/hosting/scriptlet.nl?script=2650&deploy=1&compid=5693072_SB2&h=c670f0d963a4fdf8638f'
if (context.request.method == 'POST') {
postRequestHandle(context);
} else {
getRequestHandle(context);
}
} catch (up) {
log.debug("Error Occurred:", up);
}
}
}
}
function getRequestHandle(context) {
var form = serverWidget.createForm({
title: 'Purchase Comparison 2023 Vs 2024 ',
hideNavBar: false
});
form.clientScriptFileId = CLIENT_SCRIPT_FILE_ID
var start_dt = context.request.parameters.Start_Date
var end_dt = context.request.parameters.End_Date
form.addSubmitButton({
label: "Download CSV"
})
var strt_field = form.addField({
id: 'custpage_strt_dt',
type: serverWidget.FieldType.DATE,
label: 'Start Date'
});
if (start_dt) {
strt_field.defaultValue = start_dt;
} else {
strt_field.defaultValue = "01/01/2024";
start_dt = "01/01/2024";
}
var end_field = form.addField({
id: 'custpage_end_dt',
type: serverWidget.FieldType.DATE,
label: 'End Date'
});
if (end_dt) {
end_field.defaultValue = end_dt;
} else {
end_field.defaultValue = new Date();
var date = new Date()
var day = date.getDate();
var month = date.getMonth() + 1; // Month starts from 0
var year = date.getFullYear();
// Pad day and month with leading zeros if needed
day = (day < 10) ? '0' + day : day;
month = (month < 10) ? '0' + month : month;
// Return the formatted date
end_dt = month + '/' + day + '/' + year;
}
strt_field.updateBreakType({
breakType: serverWidget.FieldBreakType.STARTCOL
});
var htmlField = form.addField({
id: 'custpage_field_html',
type: serverWidget.FieldType.INLINEHTML,
label: 'HTML'
});
htmlField.defaultValue = `
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Select2 -->
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<script src="/ui/jquery/jquery-3.5.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.7.7/xlsx.core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/1.10.100/pdf.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.6.347/pdf.worker.entry.min.js" ></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/1.10.100/pdf.worker.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<style type = "text/css">
input[type="text"], input[type="search"], textarea, button {
outline: none;
box-shadow:none !important;
border: 1px solid #ccc !important;
}
p, pre {
font-size: 10pt;
}
td, th {
font-size: 9pt;
border: 2px;
}
th {
font-weight: bold;
border: 1px ;
}
.loader {
border: 16px solid #f3f3f3;
border-radius: 50%;
border-top: 16px solid teal;
border-right: 16px solid white;
border-bottom: 16px solid teal;
width: 100px;
height: 100px;
margin-top:-50px;
-webkit-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
}
@-webkit-keyframes spin {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.divScroll {
overflow:scroll;
height:100px;
width:200px;
}
body {margin:2em;}
.tableFixHead {
overflow-y: auto; /* make the table scrollable if height is more than 200 px */
height: 660px; /* gives an initial height of 200px to the table */
width: 1795px;
opacity: 1;
}
.tableFixHead th{
position: sticky; /* make the table heads sticky */
top: 0px; /* table head will be placed from the top of the table and sticks to it */
background: #ADD8E6
}
.table {
width: 100%;
border-collapse: collapse;
}
#wrapper {
min-height: 100%;
}
</style>
<div id='wrapper' class="tableFixHead">
<div id="divLoaderReq" class="w3-display-container" style="z-index:99999999;position:absolute;background-size:cover;background-color:#36202052;width:100%;height:480px;display:none;">
<div class="loader w3-display-middle" ></div>
</div>
<table>
<table id="backordersalesordertable" class="table table-striped table-bordered" cellspacing="0">
<thead>
<tr>
<th style="width:30%">Vendor NAME</th>
<th>Purchase 2023</th>
<th>Purchase 2024</th>
<th>Purchase 2023 VS 2024</th>
</tr>
</thead>
<tbody id="tbodyLineItemView" style="width:100%;overflow:auto;">
</tbody>
</table>
</div>
<script>
$(document).ready(function () {
var table = document.getElementById('backordersalesordertable');
var requestPayload = {
'function': 'GetPurchasecomparedata',
'startdate':'`+ start_dt + `',
'enddate':'`+ end_dt + `',
'type':'inline'
}
var xhr_P = new XMLHttpRequest();
xhr_P.open('POST', '${scriptURL}', true);
xhr_P.send(JSON.stringify(requestPayload));
xhr_P.onload = function () {
if (xhr_P.status === 200) {
var fileExistsResponsePayload_boSo = JSON.parse(xhr_P.response);
console.log("fileExistsResponsePayload_boSo", fileExistsResponsePayload_boSo);
var count = 1;
var i;
var data = fileExistsResponsePayload_boSo.purchasecomparedetails;
data.sort(function(a, b) {
var vendorA = a.vendor.trim().toUpperCase(); // ignore leading space and case
var vendorB = b.vendor.trim().toUpperCase(); // ignore leading space and case
if (vendorA < vendorB) {
return -1;
}
if (vendorA > vendorB) {
return 1;
}
return 0; // names must be equal
});
for (i in fileExistsResponsePayload_boSo.purchasecomparedetails) {
var newRow = table.insertRow(-1);
var newCell = newRow.insertCell(-1);
newCell.innerHTML = data[i].vendor
var newCell = newRow.insertCell(-1);
newCell.innerHTML = (Math.round(Number(data[i].prev_purchase)*100)/100).toFixed(2);
var newCell = newRow.insertCell(-1);
newCell.innerHTML = (Math.round(Number(data[i].curr_purchase)*100)/100).toFixed(2);
var newCell = newRow.insertCell(-1);
newCell.innerHTML = (Math.round((Number(data[i].curr_purchase) - Number(data[i].prev_purchase))*100)/100).toFixed(2);
count = count + 1;
}
}
}
})
</script>
`;
htmlField.updateDisplayType({
displayType: serverWidget.FieldDisplayType.INLINE
});
context.response.writePage(form);
}
function postRequestHandle(context) {
log.debug("context.request", context.request.body);
var body = context.request.body;
// if (body.includes('submitter')) {
// log.debug("submitter")
// var End_date = context.request.parameters.custpage_enddate;
// var Start_date = context.request.parameters.custpage_startdate;
// log.debug('Start_date', Start_date)
// log.debug('End_date', End_date)
// var today = new Date(Start_date);
// log.debug("today", today)
// var yr = today.getFullYear();
// if (yr % 400 == 0 || (yr % 100 != 0 && yr % 4 == 0)) {
// if (today.getDate() == "29") {
// var prev_date = today.getDate() - 1;
// } else {
// var prev_date = today.getDate();
// }
// } else {
// var prev_date = today.getDate();
// }
// var prev_month = today.getMonth() + 1;
// var prev_year = today.getFullYear() - 1;
// if (prev_date < 10) prev_date = '0' + prev_date;
// if (prev_month < 10) prev_month = '0' + prev_month;
// var Start_Date = prev_month + '/' + prev_date + '/' + prev_year;
// var Enddate = new Date(End_date);
// var year = Enddate.getFullYear();
// if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)) {
// if (Enddate.getDate() == "29") {
// var end_date = Enddate.getDate() - 1;
// } else {
// var end_date = Enddate.getDate();
// }
// } else {
// var end_date = Enddate.getDate();
// }
// // var end_date = Enddate.getDate();
// var end_month = Enddate.getMonth() + 1;
// var end_year = Enddate.getFullYear() - 1;
// if (end_date < 10) end_date = '0' + end_date;
// if (end_month < 10) end_month = '0' + end_month;
// var End_Date = end_month + '/' + end_date + '/' + end_year;
// var curr_End_date = new Date();
// var curr_End_date1 = curr_End_date.getDate();
// var curr_End_month = curr_End_date.getMonth() + 1;
// var curr_End_year = curr_End_date.getFullYear() - 1;
// var today_curr_year = curr_End_date.getFullYear();
// if (curr_End_date1 < 10) curr_End_date1 = '0' + curr_End_date1;
// if (curr_End_month < 10) curr_End_month = '0' + curr_End_month;
// var CURR_End_Date = curr_End_month + '/' + curr_End_date1 + '/' + curr_End_year;
// var Todays_date = curr_End_month + '/' + curr_End_date1 + '/' + today_curr_year;
// var resultSet = new Array();
// resultSet.push('Customer Name,Annual Sales Projection, SALES 2023, COST 2023 , PROFIT 2023 , SALES 2024 , COST 2024 , PROFIT 2024 ,SALES 2023 VS 2024 ,COST 2023 VS 2024,PROFIT 2023 VS 2024 ');
// // if (Start_date && End_date) {
// // var prev_sales = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {amount} ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY') THEN {creditamount} ELSE 0 END END";
// // var prev_cost = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {costestimate} ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY') THEN {debitamount} ELSE 0 END END";
// // var curr_sales = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {amount} ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY') THEN {creditamount} ELSE 0 END END";
// // var curr_cost = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {costestimate} ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY') THEN {debitamount} ELSE 0 END END";
// // } else {
// // var prev_sales = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {amount} ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') THEN {creditamount} ELSE 0 END END";
// // var prev_cost = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {costestimate} ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') THEN {debitamount} ELSE 0 END END";
// // var curr_sales = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {amount} ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY') THEN {creditamount} ELSE 0 END END";
// // var curr_cost = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {costestimate} ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY') THEN {debitamount} ELSE 0 END END";
// // }
// // log.debug("prev_sales", prev_sales)
// // log.debug("prev_cost", prev_cost)
// // log.debug("curr_sales", curr_sales)
// // log.debug("curr_cost", curr_cost)
// var transactionSearchObj = search.create({
// type: "transaction",
// filters:
// [
// ["type", "anyof", "Journal", "CustInvc"],
// "AND",
// ["formulatext: {name}", "isnotempty", "none"],
// "AND",
// ["mainline", "any", ""],
// "AND",
// ["formulatext: {customer.internalid}", "isnotempty", ""],
// "AND",
// ["formulatext: {name}", "isnot", "1 MISCELLANEOUS"]
// ],
// columns:
// [
// search.createColumn({
// name: "entity",
// summary: "GROUP",
// label: "Name"
// }),
// search.createColumn({
// name: "companyname",
// sort: search.Sort.ASC,
// join: "customer",
// summary: "GROUP",
// label: "Company Name"
// }),
// search.createColumn({
// name: "formulanumeric1",
// summary: "SUM",
// formula: prev_sales,
// label: "Formula (Numeric)"
// }),
// search.createColumn({
// name: "formulanumeric2",
// summary: "SUM",
// formula: prev_cost,
// label: "Formula (Numeric)"
// }),
// search.createColumn({
// name: "formulanumeric3",
// summary: "SUM",
// formula: curr_sales,
// label: "Formula (Numeric)"
// }),
// search.createColumn({
// name: "formulanumeric4",
// summary: "SUM",
// formula: curr_cost,
// label: "Formula (Numeric)"
// }),
// search.createColumn({
// name: "custentity_annualsalesprojection",
// join: "customer",
// summary: "GROUP",
// label: "Annual Sales Projection"
// })
// ]
// });
// var searchResultCount = transactionSearchObj.runPaged().count;
// log.debug("transactionSearchObj result count", searchResultCount);
// transactionSearchObj.run().each(function (result) {
// var resultArr = new Array();
// //resultArr.push('\n"' + result.getValue({ name: "internalid", label: "internalid" }) + '"');
// var cus_name = result.getValue({
// name: "companyname",
// sort: search.Sort.ASC,
// join: "customer",
// summary: "GROUP",
// label: "Company Name"
// });
// // cus_name = cus_name.substring(cus_name.indexOf(' ') + 1);
// resultArr.push('\n"' + cus_name + '"');
// resultArr.push('"' + result.getValue({
// name: "custentity_annualsalesprojection",
// join: "customer",
// summary: "GROUP",
// label: "Annual Sales Projection"
// }) + '"');
// resultArr.push('"' + result.getValue({
// name: "formulanumeric1",
// summary: "SUM",
// formula: prev_sales,
// label: "Formula (Numeric)"
// }) + '"');
// resultArr.push('"' + result.getValue({
// name: "formulanumeric2",
// summary: "SUM",
// formula: prev_cost,
// label: "Formula (Numeric)"
// }) + '"');
// var prev_prof_col = Number(Number(result.getValue({
// name: "formulanumeric1",
// summary: "SUM",
// formula: prev_sales,
// label: "Formula (Numeric)"
// })) - Number(result.getValue({
// name: "formulanumeric2",
// summary: "SUM",
// formula: prev_cost,
// label: "Formula (Numeric)"
// })))
// resultArr.push('"' + prev_prof_col + '"');
// resultArr.push('"' + result.getValue({
// name: "formulanumeric3",
// summary: "SUM",
// formula: curr_sales,
// label: "Formula (Numeric)"
// }) + '"');
// resultArr.push('"' + result.getValue({
// name: "formulanumeric4",
// summary: "SUM",
// formula: curr_cost,
// label: "Formula (Numeric)"
// }) + '"');
// ;
// var curr_profit_col = Number(Number(Number(result.getValue({
// name: "formulanumeric3",
// summary: "SUM",
// formula: curr_sales,
// label: "Formula (Numeric)"
// })) - Number(result.getValue({
// name: "formulanumeric4",
// summary: "SUM",
// formula: curr_cost,
// label: "Formula (Numeric)"
// }))))
// resultArr.push('"' + curr_profit_col + '"');
// var sales_compare = Number(result.getValue({
// name: "formulanumeric3",
// summary: "SUM",
// formula: curr_sales,
// label: "Formula (Numeric)"
// })) - Number(result.getValue({
// name: "formulanumeric1",
// summary: "SUM",
// formula: prev_sales,
// label: "Formula (Numeric)"
// }))
// var cost_compare = Number(result.getValue({
// name: "formulanumeric4",
// summary: "SUM",
// formula: curr_cost,
// label: "Formula (Numeric)"
// })) - Number(result.getValue({
// name: "formulanumeric2",
// summary: "SUM",
// formula: prev_cost,
// label: "Formula (Numeric)"
// }))
// var profit_compare = Number(curr_profit_col) - Number(prev_prof_col)
// resultArr.push('"' + sales_compare + '"');
// resultArr.push('"' + cost_compare + '"');
// resultArr.push('"' + profit_compare + '"');
// resultSet.push(resultArr);
// return true;
// })
// var fname = 'Sales Comparison Report.csv';
// // Write to a CSV file
// var fileObj = file.create({
// name: fname,
// fileType: file.Type.CSV,
// contents: resultSet.join('')
// });
// // Accounting > Closing Month > Invoice Corrections
// fileObj.folder = -15;
// var fileid = fileObj.save();
// log.debug("fileid", fileid)
// var filePath = file.load({
// id: fileid
// });
// // var url = filePath.url;
// // window.open(url, '_blank');
// context.response.writeFile(filePath)
// }
// else {
var requestPayload = JSON.parse(context.request.body);
log.debug("requestPayload", requestPayload)
context.response.setHeader('Content-Type', 'application/json');
switch (requestPayload['function']) {
case 'GetPurchasecomparedata':
return GetPurchasecomparedata(context, requestPayload);
break;
}
// }
}
function GetPurchasecomparedata(context, requestPayload) {
log.debug("inside func reqpayload", requestPayload)
var purchasecomparedetails = [];
/*
purchaseorderSearchObj.id="customsearch1664932756807";
purchaseorderSearchObj.title="Transaction Search (copy)";
var newSearchId = purchaseorderSearchObj.save();
*/
var Start_date = requestPayload.startdate
var End_date = requestPayload.enddate;
var today = new Date(Start_date);
log.debug("today", today)
var yr = today.getFullYear();
if (yr % 400 == 0 || (yr % 100 != 0 && yr % 4 == 0)) {
if (today.getDate() == "29") {
var prev_date = today.getDate() - 1;
} else {
var prev_date = today.getDate();
}
} else {
var prev_date = today.getDate();
}
var prev_month = today.getMonth() + 1;
var prev_year = today.getFullYear() - 1;
if (prev_date < 10) prev_date = '0' + prev_date;
if (prev_month < 10) prev_month = '0' + prev_month;
var Start_Date = prev_month + '/' + prev_date + '/' + prev_year;
var Enddate = new Date(End_date);
var year = Enddate.getFullYear();
if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)) {
if (Enddate.getDate() == "29") {
var end_date = Enddate.getDate() - 1;
} else {
var end_date = Enddate.getDate();
}
} else {
var end_date = Enddate.getDate();
}
// var end_date = Enddate.getDate();
var end_month = Enddate.getMonth() + 1;
var end_year = Enddate.getFullYear() - 1;
if (end_date < 10) end_date = '0' + end_date;
if (end_month < 10) end_month = '0' + end_month;
var End_Date = end_month + '/' + end_date + '/' + end_year;
var curr_End_date = new Date();
var curr_End_date1 = curr_End_date.getDate();
var curr_End_month = curr_End_date.getMonth() + 1;
var curr_End_year = curr_End_date.getFullYear() - 1;
var today_curr_year = curr_End_date.getFullYear();
if (curr_End_date1 < 10) curr_End_date1 = '0' + curr_End_date1;
if (curr_End_month < 10) curr_End_month = '0' + curr_End_month;
var CURR_End_Date = curr_End_month + '/' + curr_End_date1 + '/' + curr_End_year;
var Todays_date = curr_End_month + '/' + curr_End_date1 + '/' + today_curr_year;
log.debug("Todays_date",Todays_date)
if (Start_date && End_date) {
log.debug("if condition")
var prev_cost = "CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY') THEN {amount} ELSE 0 END"
var curr_cost = "CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY') THEN {amount} ELSE 0 END "
} else {
log.debug("else condition")
var prev_cost = "CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') THEN {amount} ELSE 0 END"
var curr_cost = "CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY') THEN {amount} ELSE 0 END "
}
log.debug("prev_cost", prev_cost)
log.debug("curr_cost", curr_cost)
var transactionSearchObj = search.create({
type: "vendorbill",
settings: [{ "name": "consolidationtype", "value": "ACCTTYPE" }],
filters:
[
["type", "anyof", "VendBill"],
"AND",
["mainline", "any", ""],
"AND",
["formulatext: {name}", "isnotempty", ""]
],
columns:
[
search.createColumn({
name: "formulatext",
summary: "GROUP",
formula: "{name}",
label: "Formula (Text)"
}),
search.createColumn({
name: "amount",
summary: "SUM",
label: "Amount"
}),
search.createColumn({
name: "formulanumeric1",
summary: "SUM",
formula: prev_cost,
label: "Formula (Numeric)"
}),
search.createColumn({
name: "formulanumeric2",
summary: "SUM",
formula: curr_cost,
label: "Formula (Numeric)"
})
]
});
var searchResultCount = transactionSearchObj.runPaged().count;
log.debug("transactionSearchObj result count", searchResultCount);
var start = 0;
var end = 1000;
//srch.run().each(function(result)
do {
// if (searchResultCount < end) {
// end = searchResultCount;
// }
log.debug({
title: 'end',
details: end
})
var result = transactionSearchObj.run().getRange({
start: start,
end: end
});
log.debug("result", result)
for (var i = 0; i < result.length; i++) {
var soSearchobj = new Object();
soSearchobj.vendor = ("" + result[i].getValue({
name: "formulatext",
summary: "GROUP",
formula: "{name}",
label: "Formula (Text)"
})).replace(/^\d+/, '');
soSearchobj.prev_purchase = result[i].getValue({
name: "formulanumeric1",
summary: "SUM",
formula: "CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('12/30/2023', 'MM/DD/YYYY') THEN {amount} ELSE 0 END ",
label: "Formula (Numeric)"
});
soSearchobj.curr_purchase = result[i].getValue({
name: "formulanumeric2",
summary: "SUM",
formula: "CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('12/30/2024', 'MM/DD/YYYY') THEN {amount} ELSE 0 END ",
label: "Formula (Numeric)"
});
purchasecomparedetails.push(soSearchobj)
}
end += 1000;
start += 1000;
searchResultCount -= 1000;
} while (searchResultCount > 0);
log.debug("soSearchobj", purchasecomparedetails)
responsePayload = {
'purchasecomparedetails': purchasecomparedetails,
};
context.response.write(JSON.stringify(responsePayload, null, 5));
}
/**
* @NApiVersion 2.1
* @NScriptType Suitelet
*/
var addLineCounterId = 0;
var objLine = {};
var CLIENT_SCRIPT_FILE_ID = 22087;
define(['N/file', 'N/https', 'N/log', 'N/ui/message', 'N/query', 'N/record', 'N/render', 'N/runtime', 'N/ui/serverWidget', 'N/search', 'N/format', 'N/url', 'N/redirect'], main);
function main(fileModule, httpsModule, logModule, messageModule, queryModule, recordModule, renderModule, runtimeModule, serverWidgetModule, searchModule, formatModule, urlModule, redirectModule) {
file = fileModule;
https = httpsModule;
log = logModule;
message = messageModule;
query = queryModule;
record = recordModule;
render = renderModule;
runtime = runtimeModule;
serverWidget = serverWidgetModule;
url = urlModule;
search = searchModule;
format = formatModule;
redirect = redirectModule;
return {
onRequest: function (context) {
try {
var domain = 'https://';
domain += url.resolveDomain({
hostType: url.HostType.FORM,
accountId: runtime.accountId
});
log.debug('domain', domain)
scriptURL = url.resolveScript({
scriptId: runtime.getCurrentScript().id,
deploymentId: runtime.getCurrentScript().deploymentId,
returnExternalUrl: false
}); //returnExternalUrl
log.debug('scriptURL', scriptURL);
var objScript = runtime.getCurrentScript();
backgroundImg = objScript.getParameter({
name: 'custscript_backgroundimg_p2p'
});
log.debug('backgroundImg', backgroundImg);
//scriptURL = 'https://5693072-sb2.extforms.netsuite.com/app/site/hosting/scriptlet.nl?script=2650&deploy=1&compid=5693072_SB2&h=c670f0d963a4fdf8638f'
if (context.request.method == 'POST') {
postRequestHandle(context);
} else {
getRequestHandle(context);
}
} catch (up) {
log.debug("Error Occurred:", up);
}
}
}
}
function getRequestHandle(context) {
var form = serverWidget.createForm({
title: 'Purchase Comparison 2023 Vs 2024 ',
hideNavBar: false
});
form.clientScriptFileId = CLIENT_SCRIPT_FILE_ID
var start_dt = context.request.parameters.Start_Date
var end_dt = context.request.parameters.End_Date
form.addSubmitButton({
label: "Download CSV"
})
var strt_field = form.addField({
id: 'custpage_strt_dt',
type: serverWidget.FieldType.DATE,
label: 'Start Date'
});
if (start_dt) {
strt_field.defaultValue = start_dt;
} else {
strt_field.defaultValue = "01/01/2024";
start_dt = "01/01/2024";
}
var end_field = form.addField({
id: 'custpage_end_dt',
type: serverWidget.FieldType.DATE,
label: 'End Date'
});
if (end_dt) {
end_field.defaultValue = end_dt;
} else {
end_field.defaultValue = new Date();
var date = new Date()
var day = date.getDate();
var month = date.getMonth() + 1; // Month starts from 0
var year = date.getFullYear();
// Pad day and month with leading zeros if needed
day = (day < 10) ? '0' + day : day;
month = (month < 10) ? '0' + month : month;
// Return the formatted date
end_dt = month + '/' + day + '/' + year;
}
strt_field.updateBreakType({
breakType: serverWidget.FieldBreakType.STARTCOL
});
var htmlField = form.addField({
id: 'custpage_field_html',
type: serverWidget.FieldType.INLINEHTML,
label: 'HTML'
});
htmlField.defaultValue = `
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Select2 -->
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<script src="/ui/jquery/jquery-3.5.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.7.7/xlsx.core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/1.10.100/pdf.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.6.347/pdf.worker.entry.min.js" ></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/1.10.100/pdf.worker.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<style type = "text/css">
input[type="text"], input[type="search"], textarea, button {
outline: none;
box-shadow:none !important;
border: 1px solid #ccc !important;
}
p, pre {
font-size: 10pt;
}
td, th {
font-size: 9pt;
border: 2px;
}
th {
font-weight: bold;
border: 1px ;
}
.loader {
border: 16px solid #f3f3f3;
border-radius: 50%;
border-top: 16px solid teal;
border-right: 16px solid white;
border-bottom: 16px solid teal;
width: 100px;
height: 100px;
margin-top:-50px;
-webkit-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
}
@-webkit-keyframes spin {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.divScroll {
overflow:scroll;
height:100px;
width:200px;
}
body {margin:2em;}
.tableFixHead {
overflow-y: auto; /* make the table scrollable if height is more than 200 px */
height: 660px; /* gives an initial height of 200px to the table */
width: 1795px;
opacity: 1;
}
.tableFixHead th{
position: sticky; /* make the table heads sticky */
top: 0px; /* table head will be placed from the top of the table and sticks to it */
background: #ADD8E6
}
.table {
width: 100%;
border-collapse: collapse;
}
#wrapper {
min-height: 100%;
}
</style>
<div id='wrapper' class="tableFixHead">
<div id="divLoaderReq" class="w3-display-container" style="z-index:99999999;position:absolute;background-size:cover;background-color:#36202052;width:100%;height:480px;display:none;">
<div class="loader w3-display-middle" ></div>
</div>
<table>
<table id="backordersalesordertable" class="table table-striped table-bordered" cellspacing="0">
<thead>
<tr>
<th style="width:30%">Vendor NAME</th>
<th>Purchase 2023</th>
<th>Purchase 2024</th>
<th>Purchase 2023 VS 2024</th>
</tr>
</thead>
<tbody id="tbodyLineItemView" style="width:100%;overflow:auto;">
</tbody>
</table>
</div>
<script>
$(document).ready(function () {
var table = document.getElementById('backordersalesordertable');
var requestPayload = {
'function': 'GetPurchasecomparedata',
'startdate':'`+ start_dt + `',
'enddate':'`+ end_dt + `',
'type':'inline'
}
var xhr_P = new XMLHttpRequest();
xhr_P.open('POST', '${scriptURL}', true);
xhr_P.send(JSON.stringify(requestPayload));
xhr_P.onload = function () {
if (xhr_P.status === 200) {
var fileExistsResponsePayload_boSo = JSON.parse(xhr_P.response);
console.log("fileExistsResponsePayload_boSo", fileExistsResponsePayload_boSo);
var count = 1;
var i;
var data = fileExistsResponsePayload_boSo.purchasecomparedetails;
data.sort(function(a, b) {
var vendorA = a.vendor.trim().toUpperCase(); // ignore leading space and case
var vendorB = b.vendor.trim().toUpperCase(); // ignore leading space and case
if (vendorA < vendorB) {
return -1;
}
if (vendorA > vendorB) {
return 1;
}
return 0; // names must be equal
});
for (i in fileExistsResponsePayload_boSo.purchasecomparedetails) {
var newRow = table.insertRow(-1);
var newCell = newRow.insertCell(-1);
newCell.innerHTML = data[i].vendor
var newCell = newRow.insertCell(-1);
newCell.innerHTML = (Math.round(Number(data[i].prev_purchase)*100)/100).toFixed(2);
var newCell = newRow.insertCell(-1);
newCell.innerHTML = (Math.round(Number(data[i].curr_purchase)*100)/100).toFixed(2);
var newCell = newRow.insertCell(-1);
newCell.innerHTML = (Math.round((Number(data[i].curr_purchase) - Number(data[i].prev_purchase))*100)/100).toFixed(2);
count = count + 1;
}
}
}
})
</script>
`;
htmlField.updateDisplayType({
displayType: serverWidget.FieldDisplayType.INLINE
});
context.response.writePage(form);
}
function postRequestHandle(context) {
log.debug("context.request", context.request.body);
var body = context.request.body;
// if (body.includes('submitter')) {
// log.debug("submitter")
// var End_date = context.request.parameters.custpage_enddate;
// var Start_date = context.request.parameters.custpage_startdate;
// log.debug('Start_date', Start_date)
// log.debug('End_date', End_date)
// var today = new Date(Start_date);
// log.debug("today", today)
// var yr = today.getFullYear();
// if (yr % 400 == 0 || (yr % 100 != 0 && yr % 4 == 0)) {
// if (today.getDate() == "29") {
// var prev_date = today.getDate() - 1;
// } else {
// var prev_date = today.getDate();
// }
// } else {
// var prev_date = today.getDate();
// }
// var prev_month = today.getMonth() + 1;
// var prev_year = today.getFullYear() - 1;
// if (prev_date < 10) prev_date = '0' + prev_date;
// if (prev_month < 10) prev_month = '0' + prev_month;
// var Start_Date = prev_month + '/' + prev_date + '/' + prev_year;
// var Enddate = new Date(End_date);
// var year = Enddate.getFullYear();
// if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)) {
// if (Enddate.getDate() == "29") {
// var end_date = Enddate.getDate() - 1;
// } else {
// var end_date = Enddate.getDate();
// }
// } else {
// var end_date = Enddate.getDate();
// }
// // var end_date = Enddate.getDate();
// var end_month = Enddate.getMonth() + 1;
// var end_year = Enddate.getFullYear() - 1;
// if (end_date < 10) end_date = '0' + end_date;
// if (end_month < 10) end_month = '0' + end_month;
// var End_Date = end_month + '/' + end_date + '/' + end_year;
// var curr_End_date = new Date();
// var curr_End_date1 = curr_End_date.getDate();
// var curr_End_month = curr_End_date.getMonth() + 1;
// var curr_End_year = curr_End_date.getFullYear() - 1;
// var today_curr_year = curr_End_date.getFullYear();
// if (curr_End_date1 < 10) curr_End_date1 = '0' + curr_End_date1;
// if (curr_End_month < 10) curr_End_month = '0' + curr_End_month;
// var CURR_End_Date = curr_End_month + '/' + curr_End_date1 + '/' + curr_End_year;
// var Todays_date = curr_End_month + '/' + curr_End_date1 + '/' + today_curr_year;
// var resultSet = new Array();
// resultSet.push('Customer Name,Annual Sales Projection, SALES 2023, COST 2023 , PROFIT 2023 , SALES 2024 , COST 2024 , PROFIT 2024 ,SALES 2023 VS 2024 ,COST 2023 VS 2024,PROFIT 2023 VS 2024 ');
// // if (Start_date && End_date) {
// // var prev_sales = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {amount} ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY') THEN {creditamount} ELSE 0 END END";
// // var prev_cost = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {costestimate} ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY') THEN {debitamount} ELSE 0 END END";
// // var curr_sales = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {amount} ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY') THEN {creditamount} ELSE 0 END END";
// // var curr_cost = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {costestimate} ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY') THEN {debitamount} ELSE 0 END END";
// // } else {
// // var prev_sales = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {amount} ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') THEN {creditamount} ELSE 0 END END";
// // var prev_cost = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {costestimate} ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') THEN {debitamount} ELSE 0 END END";
// // var curr_sales = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {amount} ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY') THEN {creditamount} ELSE 0 END END";
// // var curr_cost = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {costestimate} ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY') THEN {debitamount} ELSE 0 END END";
// // }
// // log.debug("prev_sales", prev_sales)
// // log.debug("prev_cost", prev_cost)
// // log.debug("curr_sales", curr_sales)
// // log.debug("curr_cost", curr_cost)
// var transactionSearchObj = search.create({
// type: "transaction",
// filters:
// [
// ["type", "anyof", "Journal", "CustInvc"],
// "AND",
// ["formulatext: {name}", "isnotempty", "none"],
// "AND",
// ["mainline", "any", ""],
// "AND",
// ["formulatext: {customer.internalid}", "isnotempty", ""],
// "AND",
// ["formulatext: {name}", "isnot", "1 MISCELLANEOUS"]
// ],
// columns:
// [
// search.createColumn({
// name: "entity",
// summary: "GROUP",
// label: "Name"
// }),
// search.createColumn({
// name: "companyname",
// sort: search.Sort.ASC,
// join: "customer",
// summary: "GROUP",
// label: "Company Name"
// }),
// search.createColumn({
// name: "formulanumeric1",
// summary: "SUM",
// formula: prev_sales,
// label: "Formula (Numeric)"
// }),
// search.createColumn({
// name: "formulanumeric2",
// summary: "SUM",
// formula: prev_cost,
// label: "Formula (Numeric)"
// }),
// search.createColumn({
// name: "formulanumeric3",
// summary: "SUM",
// formula: curr_sales,
// label: "Formula (Numeric)"
// }),
// search.createColumn({
// name: "formulanumeric4",
// summary: "SUM",
// formula: curr_cost,
// label: "Formula (Numeric)"
// }),
// search.createColumn({
// name: "custentity_annualsalesprojection",
// join: "customer",
// summary: "GROUP",
// label: "Annual Sales Projection"
// })
// ]
// });
// var searchResultCount = transactionSearchObj.runPaged().count;
// log.debug("transactionSearchObj result count", searchResultCount);
// transactionSearchObj.run().each(function (result) {
// var resultArr = new Array();
// //resultArr.push('\n"' + result.getValue({ name: "internalid", label: "internalid" }) + '"');
// var cus_name = result.getValue({
// name: "companyname",
// sort: search.Sort.ASC,
// join: "customer",
// summary: "GROUP",
// label: "Company Name"
// });
// // cus_name = cus_name.substring(cus_name.indexOf(' ') + 1);
// resultArr.push('\n"' + cus_name + '"');
// resultArr.push('"' + result.getValue({
// name: "custentity_annualsalesprojection",
// join: "customer",
// summary: "GROUP",
// label: "Annual Sales Projection"
// }) + '"');
// resultArr.push('"' + result.getValue({
// name: "formulanumeric1",
// summary: "SUM",
// formula: prev_sales,
// label: "Formula (Numeric)"
// }) + '"');
// resultArr.push('"' + result.getValue({
// name: "formulanumeric2",
// summary: "SUM",
// formula: prev_cost,
// label: "Formula (Numeric)"
// }) + '"');
// var prev_prof_col = Number(Number(result.getValue({
// name: "formulanumeric1",
// summary: "SUM",
// formula: prev_sales,
// label: "Formula (Numeric)"
// })) - Number(result.getValue({
// name: "formulanumeric2",
// summary: "SUM",
// formula: prev_cost,
// label: "Formula (Numeric)"
// })))
// resultArr.push('"' + prev_prof_col + '"');
// resultArr.push('"' + result.getValue({
// name: "formulanumeric3",
// summary: "SUM",
// formula: curr_sales,
// label: "Formula (Numeric)"
// }) + '"');
// resultArr.push('"' + result.getValue({
// name: "formulanumeric4",
// summary: "SUM",
// formula: curr_cost,
// label: "Formula (Numeric)"
// }) + '"');
// ;
// var curr_profit_col = Number(Number(Number(result.getValue({
// name: "formulanumeric3",
// summary: "SUM",
// formula: curr_sales,
// label: "Formula (Numeric)"
// })) - Number(result.getValue({
// name: "formulanumeric4",
// summary: "SUM",
// formula: curr_cost,
// label: "Formula (Numeric)"
// }))))
// resultArr.push('"' + curr_profit_col + '"');
// var sales_compare = Number(result.getValue({
// name: "formulanumeric3",
// summary: "SUM",
// formula: curr_sales,
// label: "Formula (Numeric)"
// })) - Number(result.getValue({
// name: "formulanumeric1",
// summary: "SUM",
// formula: prev_sales,
// label: "Formula (Numeric)"
// }))
// var cost_compare = Number(result.getValue({
// name: "formulanumeric4",
// summary: "SUM",
// formula: curr_cost,
// label: "Formula (Numeric)"
// })) - Number(result.getValue({
// name: "formulanumeric2",
// summary: "SUM",
// formula: prev_cost,
// label: "Formula (Numeric)"
// }))
// var profit_compare = Number(curr_profit_col) - Number(prev_prof_col)
// resultArr.push('"' + sales_compare + '"');
// resultArr.push('"' + cost_compare + '"');
// resultArr.push('"' + profit_compare + '"');
// resultSet.push(resultArr);
// return true;
// })
// var fname = 'Sales Comparison Report.csv';
// // Write to a CSV file
// var fileObj = file.create({
// name: fname,
// fileType: file.Type.CSV,
// contents: resultSet.join('')
// });
// // Accounting > Closing Month > Invoice Corrections
// fileObj.folder = -15;
// var fileid = fileObj.save();
// log.debug("fileid", fileid)
// var filePath = file.load({
// id: fileid
// });
// // var url = filePath.url;
// // window.open(url, '_blank');
// context.response.writeFile(filePath)
// }
// else {
var requestPayload = JSON.parse(context.request.body);
log.debug("requestPayload", requestPayload)
context.response.setHeader('Content-Type', 'application/json');
switch (requestPayload['function']) {
case 'GetPurchasecomparedata':
return GetPurchasecomparedata(context, requestPayload);
break;
}
// }
}
function GetPurchasecomparedata(context, requestPayload) {
log.debug("inside func reqpayload", requestPayload)
var purchasecomparedetails = [];
/*
purchaseorderSearchObj.id="customsearch1664932756807";
purchaseorderSearchObj.title="Transaction Search (copy)";
var newSearchId = purchaseorderSearchObj.save();
*/
var Start_date = requestPayload.startdate
var End_date = requestPayload.enddate;
var today = new Date(Start_date);
log.debug("today", today)
var yr = today.getFullYear();
if (yr % 400 == 0 || (yr % 100 != 0 && yr % 4 == 0)) {
if (today.getDate() == "29") {
var prev_date = today.getDate() - 1;
} else {
var prev_date = today.getDate();
}
} else {
var prev_date = today.getDate();
}
var prev_month = today.getMonth() + 1;
var prev_year = today.getFullYear() - 1;
if (prev_date < 10) prev_date = '0' + prev_date;
if (prev_month < 10) prev_month = '0' + prev_month;
var Start_Date = prev_month + '/' + prev_date + '/' + prev_year;
var Enddate = new Date(End_date);
var year = Enddate.getFullYear();
if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)) {
if (Enddate.getDate() == "29") {
var end_date = Enddate.getDate() - 1;
} else {
var end_date = Enddate.getDate();
}
} else {
var end_date = Enddate.getDate();
}
// var end_date = Enddate.getDate();
var end_month = Enddate.getMonth() + 1;
var end_year = Enddate.getFullYear() - 1;
if (end_date < 10) end_date = '0' + end_date;
if (end_month < 10) end_month = '0' + end_month;
var End_Date = end_month + '/' + end_date + '/' + end_year;
var curr_End_date = new Date();
var curr_End_date1 = curr_End_date.getDate();
var curr_End_month = curr_End_date.getMonth() + 1;
var curr_End_year = curr_End_date.getFullYear() - 1;
var today_curr_year = curr_End_date.getFullYear();
if (curr_End_date1 < 10) curr_End_date1 = '0' + curr_End_date1;
if (curr_End_month < 10) curr_End_month = '0' + curr_End_month;
var CURR_End_Date = curr_End_month + '/' + curr_End_date1 + '/' + curr_End_year;
var Todays_date = curr_End_month + '/' + curr_End_date1 + '/' + today_curr_year;
log.debug("Todays_date",Todays_date)
if (Start_date && End_date) {
log.debug("if condition")
var prev_cost = "CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY') THEN {amount} ELSE 0 END"
var curr_cost = "CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY') THEN {amount} ELSE 0 END "
} else {
log.debug("else condition")
var prev_cost = "CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') THEN {amount} ELSE 0 END"
var curr_cost = "CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY') THEN {amount} ELSE 0 END "
}
log.debug("prev_cost", prev_cost)
log.debug("curr_cost", curr_cost)
var transactionSearchObj = search.create({
type: "vendorbill",
settings: [{ "name": "consolidationtype", "value": "ACCTTYPE" }],
filters:
[
["type", "anyof", "VendBill"],
"AND",
["mainline", "any", ""],
"AND",
["formulatext: {name}", "isnotempty", ""]
],
columns:
[
search.createColumn({
name: "formulatext",
summary: "GROUP",
formula: "{name}",
label: "Formula (Text)"
}),
search.createColumn({
name: "amount",
summary: "SUM",
label: "Amount"
}),
search.createColumn({
name: "formulanumeric1",
summary: "SUM",
formula: prev_cost,
label: "Formula (Numeric)"
}),
search.createColumn({
name: "formulanumeric2",
summary: "SUM",
formula: curr_cost,
label: "Formula (Numeric)"
})
]
});
var searchResultCount = transactionSearchObj.runPaged().count;
log.debug("transactionSearchObj result count", searchResultCount);
var start = 0;
var end = 1000;
//srch.run().each(function(result)
do {
// if (searchResultCount < end) {
// end = searchResultCount;
// }
log.debug({
title: 'end',
details: end
})
var result = transactionSearchObj.run().getRange({
start: start,
end: end
});
log.debug("result", result)
for (var i = 0; i < result.length; i++) {
var soSearchobj = new Object();
soSearchobj.vendor = ("" + result[i].getValue({
name: "formulatext",
summary: "GROUP",
formula: "{name}",
label: "Formula (Text)"
})).replace(/^\d+/, '');
soSearchobj.prev_purchase = result[i].getValue({
name: "formulanumeric1",
summary: "SUM",
formula: "CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('12/30/2023', 'MM/DD/YYYY') THEN {amount} ELSE 0 END ",
label: "Formula (Numeric)"
});
soSearchobj.curr_purchase = result[i].getValue({
name: "formulanumeric2",
summary: "SUM",
formula: "CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('12/30/2024', 'MM/DD/YYYY') THEN {amount} ELSE 0 END ",
label: "Formula (Numeric)"
});
purchasecomparedetails.push(soSearchobj)
}
end += 1000;
start += 1000;
searchResultCount -= 1000;
} while (searchResultCount > 0);
log.debug("soSearchobj", purchasecomparedetails)
responsePayload = {
'purchasecomparedetails': purchasecomparedetails,
};
context.response.write(JSON.stringify(responsePayload, null, 5));
}
Mathematics is a subject that challenges students worldwide, and the UK is no exception. With its intricate formulas, complex theorems, and detailed problem-solving techniques, math often becomes overwhelming for students. The pressure to excel in this subject, coupled with other academic responsibilities, leads many to seek out extra support. This guide will walk you through how to navigate mathematics assignments effectively and achieve academic success. Understanding the Basics Before delving into more advanced mathematical concepts, a strong foundation is essential. Many students struggle with assignments because they lack a clear understanding of basic mathematical principles. If you find yourself confused by a problem, it might be worth revisiting earlier material to reinforce these foundational skills. Time Management is Key Procrastination can be the downfall of many students when it comes to tackling complex math assignments. Start early, allocate specific time blocks for each task, and stick to a consistent study schedule. Breaking down assignments into smaller, manageable chunks makes the process less overwhelming and allows you to focus on one problem at a time. Practice, Practice, Practice One of the most effective ways to improve your skills in mathematics is through consistent practice. Try solving different variations of problems to understand the underlying patterns. This helps reinforce your grasp of concepts and ensures you're prepared for any problem that might come your way in an assignment. Seeking Help When Needed If you find yourself stuck on a particular problem, don't hesitate to ask for help. While collaborating with peers or turning to professors during office hours can be invaluable, there are also numerous online resources available. For students in the UK, platforms like MyAssignmentHelp.com offer access to expert guidance, where professional mathematicians and educators provide insight into difficult concepts and problem-solving techniques. How to Approach Complex Problems Mathematics assignments often involve problems that seem daunting at first glance. One effective strategy is to break the problem into smaller steps and solve each one individually. Additionally, always ensure you fully understand the question before starting; misinterpreting the task can lead to unnecessary errors. Stay Organized When working on mathematics assignments, organization is crucial. Keep your work neat, label each step clearly, and write down every formula and theorem used. Not only will this help you avoid mistakes, but it will also make it easier to review your work and understand where improvements can be made. Utilize Resources Wisely The UK is home to several academic libraries and institutions that offer valuable resources for mathematics students. Additionally, online tools and platforms can further support your learning. Websites like MyAssignmentHelp.com provide access to a wide range of study materials, past papers, and expert tutorials that can help demystify challenging topics. Review and Reflect Once you've completed your assignment, take the time to review your work thoroughly. Double-check calculations, ensure that each step logically follows the previous one, and make sure your answers are presented clearly. Reflection is an important part of the learning process—by identifying and correcting your mistakes, you’ll improve your problem-solving skills for future assignments. Conclusion Mastering mathematics assignments is a journey that requires dedication, practice, and effective strategies. By developing a strong understanding of basic concepts, managing your time, seeking help when necessary, and utilizing available resources, you can improve your mathematical abilities and approach each assignment with confidence. Remember, math may be challenging, but with the right mindset and tools, success is within reach for every student in the UK. URL Reference: https://myassignmenthelp.com/uk/mathematics-assignment-help.html
//Step1: Implement these 3 Dependencies in build.gradle.kts(Module:app)
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.5")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.5")
implementation("androidx.compose.material3:material3:1.3.0")
//Step2: Create CounterViewModel.kt
package com.example.incrementviewmodel
import androidx.lifecycle.ViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
class CounterViewModel: ViewModel(){
//Mutable State Flow to hold the counter value
//StateFlow is a read only data stream
private val _counter = MutableStateFlow(0)
val counter : StateFlow<Int> = _counter
fun incrementcounter(){
_counter.value +=1
}
}
//MainActivity.kt
package com.example.incrementviewmodel
import android.os.Bundle
import androidx.compose.foundation.layout.*//Import compose layout
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewmodel.compose.viewModel//Import this
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
display()
}
}
}
@Composable
fun display(counterViewModel: CounterViewModel = viewModel()){
val counterState = counterViewModel.counter.collectAsState()
Column( modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Text(text = "Counter: ${counterState.value}")
Spacer(modifier = Modifier.height(30.dp))
Button(onClick = {counterViewModel.incrementcounter()}) {
Text(text = "Increment")
}
}
}
package com.example.incrementcounter
import android.os.Bundle
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.example.incrementcounter.ui.theme.IncrementCounterTheme
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
display()
}
}
}
@Composable
fun display(){
var counter by remember { mutableIntStateOf(0) }
Column( modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Text(text = "Counter: $counter")
Spacer(modifier = Modifier.height(30.dp))
Button(onClick = {counter++}) {
Text(text = "Increment")
}
Button(onClick = {if(counter > 0) counter--}) {
Text(text = "Decrement")
}
}
}
<!-- 1 -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Wedding Event</title>
<style>
body {
margin: 0;
font-family: sans-serif;
}
h2 {
text-align: center;
padding: 20px 0;
}
#container {
position: relative;
}
.image {
width: 100%;
}
#overlay {
overflow: hidden;
transition: 1s ease;
width: 0px;
position: absolute;
height: 100%;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.7);
}
#text {
text-align: justify;
transform: translate(-270px, -100px);
position: absolute;
top: 0;
left: 0;
padding: 20px;
color: white;
}
#container:hover #overlay {
width: 100%;
}
</style>
</head>
<body>
<h2>Wedding Event</h2>
<div id="container">
<img src="image.jpg" alt="Wedding" class="image">
<div id="overlay">
<div id="text">
<p>A wedding is a ceremony where two people or a couple are united in marriage. Wedding traditions and customs vary greatly between cultures, ethnic groups, religions, countries, and social classes. Most wedding ceremonies involve an exchange of marriage vows by the couple, presentation of a gift (offering, ring(s), symbolic item, flowers, money), and a public proclamation of marriage by an authority figure or celebrant. Special wedding garments are often worn, and the ceremony is sometimes followed by a wedding reception. Music, poetry, prayers or readings from religious texts or literature are also commonly incorporated into the ceremony.</p>
</div>
</div>
</div>
</body>
</html>
<!-- 2 -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Events & Promotions</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
h2 {
text-align: center;
margin: 20px 0;
}
#title {
margin: 20px;
padding: 10px;
background-color: #ddd;
text-align: center;
transform: rotate(-90deg);
transform-origin: top left;
display: inline-block;
}
.divContent {
margin: 20px;
padding: 10px;
background-color: #fff;
border: 1px solid #ccc;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<h2>EVENTS & PROMOTIONS</h2>
<div id="title">Wedding Event</div>
<div class="divContent">
We intricately craft each and every proceeding of your wedding, be it a Christian nuptials or a Hindu vivaha or a Muslim nikkah. Our experts have hands-on experience in bringing your dreams to life, right from wedding cards design till the return gifts to the guests. Wedding is your day to indulge in pure love and happiness. Don't make it the day for your peak of tensions and hassles. We, as the leading wedding planners in the town, listen to and understand your budget and expectations for your princess's wedding.
</div>
<div id="title">Corporate Event</div>
<div class="divContent">
The first impression is the best impression, they say. We toil to bring that effect to your event among the public and to trend the industry. Be it corporate meetings, business seminars, award presentations or trade shows, we enrich it with fresh thinking, energetic personality and wealth of experience that we possess. You would experience the finest showcase of the event with us, to meet the needs of your esteemed clients.
</div>
<div id="title">Birthday Party</div>
<div class="divContent">
Planning a birthday party? Whether a wild party with friends or a crazy party for the kids, Most importantly, Purple7 helps you gather that ever-important catering services will be arranged as per your requirements and budget. Engage your guests in a variety of events. Host the party with a lively anchor. And we provide with many more options to make your birthday 'the talk of the town'.
</div>
</body>
</html>
<!-- 1 -->
<!DOCTYPE html>
<html>
<head>
<title>Event Schedule</title>
<style>
.outer-div {
background-color: lightgreen;
padding: 100px 5px 100px 5px;
}
.first {
background-color: lightblue;
padding: 5px 100px;
}
.second {
background-color: pink;
padding: 10px 50px;
}
.third {
background-color: yellow;
padding: 90px 30px;
}
</style>
</head>
<body>
<h1>Event Schedule</h1>
<div class="outer-div">
<h3>Corporate Events</h3>
<div class="first">
<p>Event Management of team building events that develop and motivate teams in companies and corporations. Team building events are perfect for companies and their divisions to motivate their employees and to develop real teams.</p>
</div>
</div>
<div class="outer-div">
<h3>Wedding Planning</h3>
<div class="second">
<p>We provide Wedding Event Management Service as per requirements of customers. These services are rendered by professionals who have several years of work experience.</p>
</div>
</div>
<div class="outer-div">
<h3>Award Ceremony</h3>
<div class="third">
<p>Awards ceremonies are a celebration of talent, success and achievement. We've pulled together some of the things you need to consider when organising an awards ceremony.</p>
</div>
</div>
</body>
</html>
<!-- 2 -->
<!DOCTYPE html>
<html>
<head>
<title>HoneyDew Events</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="container">
<h2>EVENTS & PROMOTIONS</h2>
<p>Our company's core objective is, simply but, to be good. Built on the principles of transparency and accountability, we work dedicatedly on designing bespoke solutions that are creative, feasible, efficient, meticulously planned and successfully implemented. We offer a range of solutions from product launches, gala dinners & conferences to theme nights, fashion shows, hostesses & models. Our events team handles all your requirements from conceptualization to execution, leaving you free to focus completely on achieving your objectives. With proper planning and logistics management and the ability to activate requisite resources, we have undertaken a wide variety of projects. Our professional operations team will manage every aspect of your event, from invitations and RSVPs, branding, sound, light and technical solutions, to local and international entertainment and event staff. With dedicated suppliers in place we are able to handle any event requirement our clients may have. Our specialized promotions department specifically focuses on providing clients with promoters, hostesses and models for marketing campaigns, events, exhibitions and fashion shows. We provide complete services covering selection, casting, training, supervision and reporting. We intricately craft each and every proceeding of your wedding, be it a Christian nuptials or a Hindu vivaha or a Muslim nikkah. Our experts have hands-on experience in bringing your dreams to life, right from wedding cards design till the return gifts to the guests. Wedding is your day to indulge in pure love and happiness..Don't make it the day for your peak of tensions and hassles. We, as the leading wedding planners in the town, listen to and understand your budget and expectations on your princess's wedding. Your dream will be brought to reality with utmost care under your own budget. And what else, free your mind from tensions..Just stretch out and watch your princess joining her hands with her prince, with a happy and tension-free face.</p>
<div class="contact-info">
<h3>Contact Us..</h3>
<h3>Let's talk about your event plan..</h3>
<i class="fa fa-home"></i>
<p>0422-2727272</p>
<i class="fa fa-phone"></i>
<p>+91 9360001060 | +918608101110</p>
<i class="fa fa-envelope"></i>
<p>info@purple7.in</p>
<i class="fa fa-address-book"></i>
<p>196/4, Sathy Road, above Union Bank, Saravanampatti, Coimbatore, Tamil Nadu - 641035, India</p>
</div>
</div>
</body>
</html>
<!-- 1 -->
<!DOCTYPE html>
<html>
<head>
<style>
/*Fill you text here*/
table {
width: 100%;
border-collapse: collapse;
}
th, td {
border: 1px solid #000000;
padding: 8px;
text-align: left;
}
thead th {
background-color: #f2f2f2;
}
tbody tr:nth-child(odd) {
background-color: #b3edcf;
}
tbody tr:nth-child(even) {
background-color: #e0f0e9;
}
</style>
</head>
<body>
<center>
<h1>Event Schedule</h1>
<div>
<table>
<tr><th>Name</th><th>Venue</th><th>Start Time</th><th>End Time</th></tr>
<tr><td>Corporate Events</td><td>RVS Hall, 3rd Floor</td><td>4.5.2018 9.00AM</td><td>4.5.2018 12.00AM</td></tr>
<tr><td>Wedding Planning</td><td>Sri Plus Thirumana Mahal</td><td>1.1.2019 7.00AM</td><td>1.1.2019 9.00AM</td></tr>
<tr><td>Product Launches</td><td>RVS Hall, 2nd Floor</td><td>4.5.2018 2.00PM</td><td>4.5.2018 5.00PM</td></tr>
<tr><td>Seminor on Cloud Computing</td><td>Vivekanandha Auditorium</td><td>18.12.2018 8.30AM</td><td>18.12.2018 1.00PM</td></tr>
<tr><td>Heavenly Fashion</td><td>Bath Record Office</td><td>21.3.2018 5.00PM</td><td>21.3.2018 8.00PM</td></tr>
<tr><td>Gala Dinners</td><td>City Tower, Hall No 2</td><td>12.1.2018 7.00 PM</td><td>12.1.2018 10.00 PM</td></tr>
<tr><td>Award Ceremony</td><td>Hindustan Auditorium</td><td>11.11.2018 9.00 AM</td><td>11.11.2018 5.00 PM</td></tr>
</table>
</div>
</center>
</body>
</html>
<!-- 2 -->
<!DOCTYPE html>
<html>
<head>
<title>Wedding Planner</title>
<style>
table {
border: 1px solid black;
border-collapse: collapse;
}
td {
padding: 0px;
}
.space1 {
margin: 150px 0px 0px 80px;
background-color: lightgreen;
}
.space2 {
margin: 150px 80px 0px 0px;
background-color: lightblue;
}
.space3 {
margin: 0px 0px 150px 80px;
background-color: yellow;
}
.space4 {
margin: 0px 80px 150px 0px;
background-color: pink;
}
</style>
</head>
<body>
<table>
<tr>
<td><div class="space1">A wedding planner is a professional who assists with the design, planning and management of a client's wedding.</div></td>
<td><div class="space2">A wedding planner is a professional who assists with the design, planning and management of a client's wedding.</div></td>
</tr>
<tr>
<td><div class="space3">A wedding planner is a professional who assists with the design, planning and management of a client's wedding.</div></td>
<td><div class="space4">A wedding planner is a professional who assists with the design, planning and management of a client's wedding</div></td>
</tr>
</table>
</body>
</html>
<!-- contactUs.html -->
<!DOCTYPE html>
<html>
<head>
<link href="StyleSheet.css" rel="stylesheet" type="text/css">
</head>
<body>
<center>
<h1>Pink Frag Event Organizer</h1><br>
</center>
<table width="100%">
<tr>
<td width="20%">
<a id="home1" href="index.html">Home</a><br>
<a id="events" href="events.html">Events</a><br>
<a id="aboutus" href="aboutUs.html">About Us</a><br>
<a id="contactus" href="contactUs.html">Contact Us</a><br>
</td>
<td width="80%" style="display: inline-block;margin-top: -20px;">
<h2>Contact Us</h2>
<p>14/509A,Sterlin Street,Nungambakkam, Chennai - 600034.</p>
<p>Mobile : 9596645125</p>
<p>Landline : 0422-2727272</p>
<p>EMail : pinkfragOfficial@gmail.com</p>
</td>
</tr>
</table>
</body>
</html>
<!-- aboutUs.html -->
<!DOCTYPE html>
<html>
<head>
<link href="StyleSheet.css" rel="stylesheet" type="text/css">
</head>
<body>
<center>
<h1>Pink Frag Event Organizer</h1><br>
</center>
<table width="100%">
<tr>
<td width="20%">
<a id="home1" href="index.html">Home</a><br>
<a id="events" href="events.html">Events</a><br>
<a id="aboutus" href="aboutUs.html">About Us</a><br>
<a id="contactus" href="contactUs.html">Contact Us</a><br>
</td>
<td width="80%" style="display: inline-block;margin-top: -20px;">
<h2>About Us</h2>
<p>Pink Frag Event is a reputed organization,
which has come into being in 2009, as a Sole Proprietorship
Firm, with a sole aim of achieving the trust and support of
large customers. We have indulged our all endeavors towards
offering trustworthy Wedding Event Management, Promotional
Event Management, Birthday Party Management and many more.
To offer these services, we have hired specialized professionals, who are
capable of understanding as well as accomplishing the specific
customers’ desires.</p>
</td>
</tr>
</table>
</body>
</html>
<!-- events.html -->
<!DOCTYPE html>
<html>
<head>
<link href="StyleSheet.css" rel="stylesheet" type="text/css">
</head>
<body>
<center>
<h1>Pink Frag Event Organizer</h1><br>
</center>
<table width="100%">
<tr style="display:inline-flex;">
<td width="20%" style="display:inline;">
<a id="home1" href="index.html">Home</a><br>
<a id="events" class="index" name="index1" href="events.html">Events</a><br>
<a id="aboutus" href="aboutUs.html">About Us</a><br>
<a id="contactus" href="contactUs.html">Contact Us</a>
</td>
<td width="80%" style="display: inline-block;margin-top: -20px;">
<h2>Events</h2>
<h3>Corporate Events</h3>
<p width="60%">A corporate event can be defined as a gathering that is sponsored by a business for its
employees, business partners, clients and/or prospective clients. These events can be for larger
audiences such as conventions or smaller events like conferences, meetings or holiday parties.</p>
<h3>Wedding Planning</h3>
<p>A wedding planner is a professional who assists with the design, planning and management of a
client's wedding. Weddings are significant events in people's lives and as such, couples are often
willing to spend considerable amount of money to ensure that their weddings are well-organized.
Wedding planners are often used by couples who work long hours and have little spare time available
for sourcing and managing wedding venues and wedding suppliers.</p>
<h3>Product Launches</h3>
<p>The debut of product into the market. The product launch signifies the point at which consumers first
have access to a new product.</p>
</td>
</tr>
</table>
</body>
</html>
<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
<style>
a {
background-color: #00CED1;
color: #000000;
width: 100px;
border: 1px solid #000000;
padding: 15px;
text-align: center;
text-decoration: none;
display: inline-block;
margin-bottom: 5px;
}
a:hover {
background-color: #4CAF50;
color: #FFFFFF;
}
a:active {
background-color: #F0E68C;
color: #FF8C00;
}
</style>
</head>
<body>
<center>
<h1>Pink Frag Event Organizer</h1><br>
</center>
<table width="100%">
<tr>
<td width="20%">
<a id="home1" href="index.html">Home</a><br>
<a id="events" href="events.html">Events</a><br>
<a id="aboutus" href="aboutUs.html">About Us</a><br>
<a id="contactus" href="contactUs.html">Contact Us</a><br>
</td>
<td width="80%" style="display: inline-block;margin-top: -20px;">
<h2>Pink Frag Event Organizer</h2>
<p>We are indulged in offering a Promotional Event Management.
These services are provided by our team of professionals as
per the requirement of the client.
These services are highly praised for their features like
sophisticated technology, effective results and reliability. We offer
these services in a definite time frame and at affordable rates.</p>
</td>
</tr>
</table>
</body>
</html>
<!-- 2nd question -->
<!DOCTYPE html>
<head>
<style>
img {
display: block;
margin: 20px auto;
width: 80%;
max-width: 600px;
}
</style>
</head>
<html>
<body>
<h1>Wedding Album</h1>
<img src="wedding.jpg" alt="Wedding Photo 1">
<img src="wedding.jpg" alt="Wedding Photo 2" style="filter:grayscale(100%)">
</body>
</html>
<!-- 1 -->
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
}
h1 {
text-align: center;
margin-bottom: 20px;
}
.content-box {
background-color: #40E0D0;
padding: 15px;
margin: 10px 0;
}
.ellipsis-box {
background-color: #40E0D0;
padding: 15px;
margin: 10px 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
</head>
<body>
<h1>Wedding Event</h1>
<div class="content-box">
Our experts have hands on experience in bringing your dreams to life, right from wedding cards
design till the return gifts to the guests.
</div>
<div class="ellipsis-box">
Our experts have hands on experience in bringing your dreams to life, right from wedding cards
design till the return gifts to the guests.
</div>
</body>
</html>
<!-- 2 -->
<!DOCTYPE html>
<html>
<head>
<title>My First Website</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
background-image: url('bamboo.jpg');
background-repeat: no-repeat;
background-size: 100% ;
font-family: Arial, sans-serif;
padding: 20px;
}
</style>
</head>
<body>
<h1>Pink Frag Event Organizer</h1>
<hr>
<h2>Service Description</h2>
<p>We are indulged in offering a Promotional Event Management.
These services are provided by our team of professionals as
per the requirement of the client.
These services are highly praised for their features like
sophisticated technology, effective results and reliability. We offer
these services in a definite time frame and at affordable rates.
</p>
<hr>
<h2> Features</h2>
<h5>Customized services</h5>
<h5>On-time completion</h5>
<h5>Execution in tandem with clients demand</h5>
<hr>
<h2>About Us</h2>
<p> Pink Frag Event is a reputed organization,
which has come into being in 2009, as a Sole Proprietorship
Firm, with a sole aim of achieving the trust and support of
large customers. We have indulged our all endeavors towards
offering trustworthy Wedding Event Management, Promotional
Event Management, Birthday Party Management and many more.
All our services are reliable and offered keeping the exact
customers’ preferences and choice in mind. To offer these
services, we have hired specialized professionals, who are
capable of understanding as well as accomplishing the specific
customers’ desires. We have adopted modern technology,
to cope up with the challenges of industry. We keep all quality
parameters in mind, so that we cannot make any compromise in
terms of the excellence of products. </p>
<hr>
<h2>Contact Us</h2>
<h3>Address</h3>
<p>14/509A,Sterlin Street,Nungambakkam
Chennai - 600034.</p>
<h3>Mobile</h3>
<p>Manager-9596645125</p>
<h3>Landline</h3>
<p>0422-2727272</p>
<h3>EMail</h3>
<p>pinkfragevent123@gmail.com pinkfragOfficial@gmail.com
</p>
</body>
</html>
<!-- 1 -->
<!DOCTYPE html>
<html>
<body>
<h1>Registration Form</h1>
<form action="display.php" method="POST">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br><br>
<label for="userName">userName:</label>
<input type="text" id="userName" name="userName" required><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br><br>
<label for="mobilenumber">Mobile Number:</label>
<input type="text" id="mobilenumber" name="mobilenumber" maxlength="10" required><br><br>
<label for="address">Address:</label>
<textarea id="address" name="address" maxlength="200" required></textarea><br><br>
<input type="submit" value="Register" name="register">
</form>
</body>
</html>
<!-- 2 -->
<!DOCTYPE html>
<html>
<body>
<h1>Event Search</h1>
<form action="search.php" method="GET">
<label for="event">Enter an event:</label>
<input type="text" id="event" name="someText" list="text" required>
<datalist id="text">
<option value="Bridal party">
<option value="Engagement parties">
<option value="Caterer">
<option value="Wedding ceremony">
<option value="Wedding reception">
</datalist>
<input type="submit" name="search" value="Search">
</form>
</body>
</html>
<!-- 1 -->
<!DOCTYPE html>
<html>
<body>
<h1>Wedding and Events Planning</h1>
<p>You can't imagine your wedding day without your best friends. So read our advice on how to choose your bridesmaids and groomsmen, get their duties in detail, and new bridesmaid and groomsmen gift ideas. Plus, read all you need to know about casting your very important extras -- from the flower girl to the ushers, readers, and candlelighters.</p>
<ol>
<li>Bridal party</li>
<li>Engagement parties</li>
<li>Caterer</li>
<li>Wedding ceremony</li>
</ol>
<p>One of the most personal and important aspects of your wedding planning process will be choosing your wedding party! Your wedding party (also known as the bridal party) will include not only the people who will help you plan your big day, but they also are those you will want by your side when you walk down the aisle and say your vows. Typically your wedding party is made up of your sisters, brothers, and closest friends or family members. This page will serve as a guide to share all of the duties, roles, and responsibilities that are involved for each participant of the wedding party. Each individual member of the wedding party has unique responsibilities, so click on each of the roles below to read thorough explanations of those duties.</p>
<ol start="5">
<li>Seminars and Conferences</li>
<li>Appreciation Events</li>
<li>Team Building Events</li>
</ol>
<p>An engagement party is a party held to celebrate a couple's recent engagement and to help future wedding guests to get to know one another. Traditionally, the bride's parents host the engagement party, but many modern couples host their own celebration.</p>
</body>
</html>
<!-- 2 -->
<!DOCTYPE html>
<html>
<body>
<h1>Event Schedule List</h1>
<div id="CommonEvents">
<h2>Supported Events</h2>
<ul type="circle">
<li>Concerts</li>
<li>Conferences</li>
<li>Films</li>
<li>Panel Debates</li>
<li>Performances</li>
<li>Seminars</li>
<li>Talks & Discussions</li>
<li>Workshops</li>
</ul>
</div>
<div id="CorporateEvents">
<h2>Corporate Events</h2>
<ul type="square">
<li>Team Building Events</li>
<li>Trade Shows</li>
<li>Business Dinners</li>
<li>Networking Events</li>
<li>Opening Ceremonies</li>
<li>Product Launches</li>
<li>Theme Parties</li>
<li>Shareholder Meetings</li>
</ul>
</div>
</body>
</html>
<!-- index.html -->
<html lang="en">
<body>
<h1>Pink Frag Event Organizer</h1>
<table border="1">
<tr>
<td width="20%">
<a href="index.html">Home</a>
<a href="events.html">Events</a>
<a href="aboutUs.html">About us</a>
<a href="contactUs.html">Contact Us</a>
</td>
<td width="80%">
<h2>Pink Frag Event Organizer</h2>
<p>
We are indulged in offering a Promotional Event Management. These services are provided by our team
of
professionals as per the requirement of the client. These services are highly praised for their
features
like sophisticated technology, effective results, and reliability. We offer these services in a
definite
time frame and at affordable rates.
</p>
</td>
</tr>
</table>
</body>
</html>
<!-- events.html -->
<html lang="en">
<body>
<h1>Pink Frag Event Organizer</h1>
<table border="1">
<tr>
<td width="20%">
<a href="index.html">Home</a>
<a href="events.html">Events</a>
<a href="aboutUs.html">About us</a>
<a href="contactUs.html">Contact Us</a>
</td>
<h2>Events</h2>
<h3>Corporate Events</h3>
<td>
<p>
A corporate event can be defined as a gathering that is sponsored by a business for its employees,
business partners,
clients and/or prospective clients.
</p>
</td>
<h3>Wedding Planning</h3>
<p>
A wedding planner is a professional who assists with the design, planning, and management of a client's
wedding.
Weddings are significant events in people's lives, and as such, couples are often willing to spend
considerable amounts
of money to ensure that their weddings are well-organized. Wedding planners are often used by couples
who work long hours
and have little spare time available for sourcing and managing wedding venues and wedding suppliers.
</p>
<h3>Product Launches</h3>
<p>
The debut of a product into the market. The product launch signifies the point at which consumers first
have access to a
new product.
</p>
</tr>
</table>
</body>
</html>
<!-- aboutus.html -->
<html lang="en">
<body>
<h1>Pink Frag Event Organizer</h1>
<table border="1">
<tr>
<td width="20%">
<a href="index.html">Home</a>
<a href="events.html">Events</a>
<a href="aboutUs.html">About us</a>
<a href="contactUs.html">Contact Us</a>
</td>
<td width="80%">
<h2>About us</h2>
<p>
Pink Frag Event is a reputed organization, which has come into being in 2009, as a Sole Proprietorship Firm,
with a sole aim of achieving the trust and support of large customers. We have indulged our all endeavors
towards offering trustworthy Wedding Event Management, Promotional Event Management, Birthday Party Management
and many more. To offer these services, we have hired specialized professionals, who are capable of understanding
as well as accomplishing the specific customers’ desires.
</p>
</td>
</tr>
</table>
</body>
</html>
<!-- contactus.html -->
<html>
<body>
<h1>Pink Frag Event Organizer</h1>
<table border="1">
<tr>
<td width="20%">
<a href="#">Home</a>
<a href="#">Events</a>
<a href="#">About us</a>
<a href="#">Contact Us</a>
</td>
<td width="80%">
<h2>Contact us</h2>
<p>14/509A,Sterlin Street,Nungambakkam, Chennai - 600034.</p>
</td>
</tr>
</table>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pink Frag Event Management</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
table {
width: 100%;
border-collapse: collapse;
}
td {
padding: 10px;
border: 1px solid #ddd;
}
img {
max-width: 100%;
height: auto;
}
h1 {
text-align: center;
}
.title {
font-weight: bold;
margin-bottom: 10px;
}
</style>
</head>
<body>
<h1>Pink Frag Event Management</h1>
<table id="eventTable">
<!-- First Row -->
<tr>
<td colspan="1"><img src="eventLogo1.png" id="eventLogo1" alt="Event Logo 1"></td>
<td colspan="4">Pink Frag Event Management</td>
<td colspan="1"><img src="eventLogo2.png" id="eventLogo2" alt="Event Logo 2"></td>
</tr>
<!-- Second Row -->
<tr>
<td colspan="2">
Event management is the application of project management to the creation and development of large scale events such as festivals, conferences, ceremonies, weddings, formal parties, concerts, or conventions. It involves studying the brand, identifying its target audience, and coordinating the technical aspects before actually launching the event.
</td>
<td colspan="2">
The process of planning and coordinating the event is usually referred to as event planning and which can include budgeting, scheduling, site selection, acquiring necessary permits, coordinating transportation and parking, arranging for speakers or entertainers, arranging decor, event security, catering, coordinating with third party vendors, and emergency plans.
</td>
<td colspan="2">
Each event is different in its nature, so process of planning & execution of each event differs on the basis of type of event. The events industry now includes events of all sizes from the Olympics down to business breakfast meetings. Many industries, charitable organizations, and interest groups hold events in order to market themselves or celebrate an achievement.
</td>
</tr>
<!-- Third Row -->
<tr>
<td colspan="3">
<div class="title">Wedding Planner</div>
A wedding planner is a professional who assists with the design, planning and management of a client's wedding. Weddings are significant events in people's lives and as such, couples are often willing to spend a considerable amount of money to ensure that their weddings are well-organized.
</td>
<td colspan="3">
<div class="title">Corporate Event</div>
A corporate event can be defined as a gathering that is sponsored by a business for its employees, business partners, clients and/or prospective clients. These events can be for larger audiences such as conventions or smaller events like conferences, meetings or holiday parties.
</td>
</tr>
</table>
</body>
</html>
<!-- 1 -->
<!DOCTYPE html>
<html>
<body>
<h1>Pink Frag Event Organizer</h1>
<img src="../images/Event_Picture.jpg" />
<h2>Service Description</h2>
<p>We are indulged in offering a Promotional Event Management. These services are provided by our team of professionals as per the requirement of the client. These services are highly praised for their features like sophisticated technology, effective results and reliability. We offer these services in a definite time frame and at affordable rates.</p>
</body>
</html>
<!-- 2 -->
<!DOCTYPE html>
<html>
<body>
<h2>Events</h2>
<picture>
<source media="(min-width: 650px)" srcset="teamBuilding.jpg">
<source media="(min-width: 500px)" srcset="weddingAlbum.jpg">
<img src="newyear.jpg" alt="Event image" style="width:auto;">
</picture>
</body>
</html>
<!-- 1 -->
<!DOCTYPE html>
<html>
<h2>Wedding Event</h2>
<p>A wedding is a ceremony where two people or a couple are united in marriage. Wedding traditions and customs vary
greatly between cultures, ethnic groups, religions, countries, and social classes. Most wedding ceremonies involve
an exchange of marriage vows by the couple, presentation of a gift, and a public proclamation of marriage by an
authority figure or celebrant. Special wedding garments are often worn, and the ceremony is sometimes followed by a
wedding reception. Music, poetry, prayers or readings from religious texts or literature are also commonly
incorporated into the ceremony.</p>
<blockquote cite="https://www.brainyquote.com/quotes/sheri_l_dew_679111">
<q>Neither man nor woman is perfect or complete without the other. Thus, no marriage or family, no ward or stake is
likely to reach its full potential until husbands and wives, mothers and fathers, men and women work together in
unity of purpose, respecting and relying upon each other's strengths.</q>
</blockquote>
</html>
<!-- 2 -->
<html>
<head>
<title>My First Website</title>
</head>
<body>
<h1>Olympic Games</h1>
<p>The modern <b>Olympic Games</b> or <b>Olympics</b> are leading international sporting events featuring summer and
winter sports competitions in which thousands of <i>athletes</i> from around the world participate in a variety
of competitions. The Olympic Games are considered the world's foremost sports competition with more than <i>200
nations</i> participating. The Olympic Games are normally held every <u>four years</u>, alternating between
the
<u>Summer</u> and <u>Winter Olympics</u> every two years in the four-year period.
</p>
<p>Their creation was inspired by the <ins>ancient Olympic Games</ins>, held in Olympia, Greece from the 8th century
BC
to the 4th century AD. <mark>Baron Pierre de Coubertin</mark> founded the <ins>International Olympic
Committee</ins> (IOC)
in 1894, leading to the first modern Games in Athens in 1896. The IOC is the governing body of the Olympic
Movement, with the <small>structure and authority</small> defined by the Olympic Charter.</p>
<p>The evolution of the Olympic Movement during the <i>20<sup>th</sup> and 21<sup>st</sup></i> centuries has
resulted in several changes to the Olympic Games. Some of these adjustments include the creation of the Winter
Olympic Games for snow and ice sports, the Paralympic Games for athletes with disabilities, the Youth Olympic
Games for athletes aged <sub>14 to 18</sub>, the five Continental games <big>(Pan American, African, Asian,
European, and
Pacific)</big>, and the World Games for sports that are not contested in the Olympic Games. The IOC also
endorses the Deaflympics and the Special Olympics. The IOC has needed to adapt to a variety of
<del>economic, political, and technological</del> advancements.
</p>
<p>The <tt>Olympic Movement consists of international sports federations (IFs), National Olympic Committees (NOCs),
and <small>organising committees</small> for each specific Olympic Games.</tt></p>
</body>
</html>
.title {
border-radius: 16px;
border: 1px solid #e8e9fb;
box-shadow: 0 0 10px #e8e9fb;
text-align: center;
color: #12a3f5;
width: fit-content;
min-width: 80px;
padding: 0 10px;
position: relative;
left: 50%;
translate: -50%;
margin-bottom: 6px;
&:before {
content: "";
width: 300%;
height: 2px;
background: #e8e9fb;
position: absolute;
bottom: -6px;
left: 50%;
translate: -50%;
background: linear-gradient(to right, rgba(255, 255, 255, 0) ,#e8e9fb,rgba(255, 255, 255, 0));
}
}
Thu Sep 19 2024 05:50:03 GMT+0000 (Coordinated Universal Time) https://www.programiz.com/cpp-programming/online-compiler/
Thu Sep 19 2024 05:40:30 GMT+0000 (Coordinated Universal Time) https://www.programiz.com/cpp-programming/online-compiler/
Thu Sep 19 2024 04:24:57 GMT+0000 (Coordinated Universal Time) https://secure.helpscout.net/inboxes/a66af2abc7090990/views/4174596
Wed Sep 18 2024 20:33:34 GMT+0000 (Coordinated Universal Time) https://www.programiz.com/cpp-programming/online-compiler/
Wed Sep 18 2024 19:29:50 GMT+0000 (Coordinated Universal Time) https://admin-junkies.com/threads/regular-backups-and-disaster-recovery-planning.15429/
Wed Sep 18 2024 18:45:49 GMT+0000 (Coordinated Universal Time) https://clackamasnewstg2.prod.acquia-sites.com/node/145826/edit
Wed Sep 18 2024 17:41:51 GMT+0000 (Coordinated Universal Time) https://www.clackamas.us/node/173136/edit
Wed Sep 18 2024 09:39:59 GMT+0000 (Coordinated Universal Time) https://www.coinsclone.com/top-blockchains-to-launch-nft-marketplace/
@LilianAnderson #nftmarketplacedevelopment #nftblockchain #nftbusinesssolutions #nftsonethereum #nftcreators


