SHARE
TWEET

Untitled

a guest Jul 12th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def percentage(siteElement, excelCell, columnName):
  2.     text = siteElement.text
  3.     textrep = text.replace(' ', '').replace(',', '.')
  4.     first_element = float(textrep)
  5.  
  6.     second_element = float(excelCell.value.replace(',', ''))
  7.  
  8.     if (first_element != second_element):
  9.         if (first_element > second_element):
  10.             percent = 100 * first_element/second_element - 100
  11.             diff = first_element - second_element
  12.             percent = abs(percent)
  13.             diff = abs(diff)
  14.             # print (percent)
  15.             print(round(diff, 2), "$", columnName)
  16.             if (percent > 10):
  17.                 print("+",  round(percent, 2), "%", ' ', columnName)
  18.         else:
  19.             percent = 100-100*second_element/first_element
  20.             diff = second_element - first_element
  21.             percent = abs(percent)
  22.             diff = abs(diff)
  23.             # print (percent)
  24.             print(round(diff, 2), "$", columnName)
  25.             if (percent > 10):
  26.                 print("-",  round(percent, 2), "%", ' ', columnName)
  27.     else:
  28.         print("ok")
  29.  
  30.  
  31. percentage(buyouts, d1332, "Выкуплено заказов на сумму")
  32. percentage(cs, e1332, "Услуги КС1")
  33. percentage(cod, f1332, "Денег получено от выкупленных заказов")
  34. percentage(cs2, g1332, "Услуги КС2")
  35. percentage(uncod, h1332, "Денег не получено от выкупленных заказов")
  36. percentage(cs3, i1332, "Услуги КС3")
  37. percentage(debtsum, j1332, "Сумма задолжности")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top