NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

def EmeaVsEmeaDsa(self):
self.window.destroy()
# Select the current EMEA Quote PDF
curEmeaQuoteFD = fd.askopenfilename(title='Select Current EMEA Quote')
# Select the EMEA DSA Excel file
emeaDsaFD = fd.askopenfilename(title='Select EMEA DSA Excel File', filetypes=[("Excel files", "*.xlsx *.xls")])

# Initialize the EMEA Quote
curEmeaQuote = EMEAQuote(curEmeaQuoteFD)
curEmeaQuote.getData()

# Read the EMEA DSA Excel file
emeaDsaData = pd.read_excel(emeaDsaFD, header=None)

# Convert EMEA Quote SKUs and quantities to a dictionary for easier comparison
emeaQuoteDict = {sku: qty for sku, qty in curEmeaQuote.skusWithQuantities if pd.notna(sku)}

# Aggregate quantities for each SKU in EMEA DSA
emeaDsaAggregated = {}
for index, row in emeaDsaData.iterrows():
sku = str(row.iloc[10]).strip() # SKU column
qty = row.iloc[13] # Quantity column

if pd.isna(sku) or sku.lower() in ["sku", "qty", "subtotal"]:
continue # Skip rows with irrelevant or missing SKU information

emeaDsaAggregated[sku] = emeaDsaAggregated.get(sku, 0) + qty

# Initialize variables to track SKUs and quantities not matched
notInEmeaDsa = []
notInEmeaQuote = []
qtyMismatch = []

for sku, qty in emeaQuoteDict.items():
if sku in emeaDsaAggregated:
if emeaDsaAggregated[sku] != qty:
qtyMismatch.append((sku, qty, emeaDsaAggregated[sku]))
else:
notInEmeaQuote.append((sku, qty))

for sku, qty in emeaDsaAggregated.items():
if sku not in emeaQuoteDict:
notInEmeaDsa.append((sku, qty))

# Generate and save the report
report_content = "Emea Gii vs. Emea Dsa Report:n"
report_content += "-------------------------n"
report_content += "SKUs not in DSA (in Gii):n"
for sku, qty in notInEmeaQuote:
report_content += f"{sku}: {qty}n"

report_content += "-------------------------n"
report_content += "SKUs not in Gii (in Dsa):n"
for sku, qty in notInEmeaDsa:
report_content += f"{sku}: {qty}n"

report_content += "-------------------------n"
report_content += "SKUs with quantity mismatch:n"
for sku, gii_qty, dsa_qty in qtyMismatch:
report_content += f"{sku}: GII Qty = {gii_qty}, DSA Qty = {dsa_qty}n"

# Define the filename and save the report
report_filename = 'EMEA_vs_DSA_report.txt'
report_file_path = os.path.join(os.path.dirname(curEmeaQuoteFD), report_filename)
with open(report_file_path, 'w') as file:
file.write(report_content)

print(f"Report saved: {report_file_path}")
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.